# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995061 | 2024-06-08T11:48:46 Z | Nika533 | Library (JOI18_library) | C++14 | 1 ms | 344 KB |
#pragma gcc diagnostic "-std=c++1z" #include <bits/stdc++.h> #include "library.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(),(x).rend() using namespace std; int m,T,k; void Solve(int n){ vector<int> v(n,1); int st; for (int i=1; i<=n; i++) { v[i-1]=0; if (Query(v)==1) st=i; v[i-1]=1; } for (int i=1; i<=n; i++) v[i-1]=0; v[st-1]=1; cout<<st<<endl; vector<int> res; res.pb(st); for (int i=2; i<=n; i++) { vector<int> q; for (int i=1; i<=n; i++) { if (v[i-1]==0) q.pb(i); } int l=0,r=q.size()-1,ind=-1; while (l<=r) { vector<int> u=v; int mid=(l+r)/2; // cout<<"MID "<<mid<<endl; for (int j=0; j<=mid; j++) { u[q[j]-1]=1; } int x=Query(u); u[res.back()-1]=0; int y=Query(u); if ((i!=2 && x==y-1) || (i==2 && x==y)) { ind=mid; r=mid-1; } else { l=mid+1; } } // cout<<"IND "<<ind<<endl; v[q[ind]-1]=1; res.pb(q[ind]); cout<<q[ind]<<endl; } Answer(res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |