|
|
back to boardWA8 Posted by Hi4ko 26 Sep 2011 01:36 #include <iostream> #include <cstdlib> #include <vector> using namespace std; int main() { int n,m,al; int aga=1,t=0; vector<int> algo; cin>>n>>m; int lol; for(int i=0;i<m;i++) { cin>>al; algo.push_back(al); } for(int j=n;j>=1;j--) { lol=rand()%n+1; for(vector<int>::iterator it=algo.begin();it!=algo.end();it++) { if(*it==lol) { aga=0; break; } else { int dir=rand()%2; if(dir==0) { if(lol!=0) --lol; else ++lol; } else { if(lol!=n) ++lol; else --lol; } } } if(aga==1) { cout<<"NO"<<endl; t=1; break; } aga=1; } if(t==0) cout<<"YES"<<endl; } what's the mistake? |
|
|