# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315229 | 2020-10-22T05:02:49 Z | thtsshz_bgwrswh | Mouse (info1cup19_mouse) | C++17 | 0 ms | 0 KB |
#pragma GCC optimize("Ofast") #include "grader.h" #include<stdio.h> #include<algorithm> #include<assert.h> using namespace std; int num[500]; bool check[500],wrong[500]; void solve(int n){ int i,j; for(i=0;i<n;i++) wrong[i]=check[i]=0; vector<int> vec(n); for(i=0;i<n;i++) vec[i]=i+1; random_shuffle(vec.begin(),vec.end()); int now=query(vec); if(now==n) return; while(1){ for(i=0;i<(int)order.size();i++){ for(j=i+1;j<(int)order.size();j++){ if(check[i]||check[j]) continue; swap(vec[order[i]],vec[order[j]]); int v=query(vec); if(v==n) return; if(v==now+2){ now+=2; check[i]=check[j]=1; break; } else if(v==now+1) now++; else swap(vec[order[i]],vec[order[j]]); } } } }