# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995069 | 2024-06-08T11:51:56 Z | Nika533 | Library (JOI18_library) | C++14 | 3 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){ if (n==1) { vector<int> Q; Q.pb(1); Answer(Q); return; } 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; 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; 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; } } 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 | 3 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |