【题目链接】:http://codeforces.com/contest/814/problem/A
【题意】
a数组中有k个位置没填上元素;
b数组中恰好有k个元素;
让你把这k个元素按照一定的顺序填回a数组;
问你最后能不能使得a数组不是升序的;
保证每个数字都不同;
【题解】
k的个数>1的话;
直接就有解了;
k=1的话,填回去,看看是不是降序的;
否则无解;
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0),cin.tie(0)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;
int n,k;
int a[N];
int main(){
//Open();
Close();//scanf,puts,printf not use
//init??????
cin >> n >> k;
if (k > 1){
cout <<"Yes"<<endl;
return 0;
}
rep1(i,1,n)
cin >> a[i];
cin >> k;
rep1(i,1,n)
if (a[i]==0)
a[i] = k;
int ok = 1;
rep1(i,1,n-1)
if (a[i]>a[i+1])
ok = 0;
if (!ok){
cout <<"Yes"<<endl;
}
else
cout <<"No"<<endl;
return 0;
}