# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
402038 | 2021-05-11T08:36:01 Z | victoriad | Library (JOI18_library) | C++14 | 1 ms | 328 KB |
#include <cstdio> #include <vector> #include "library.h" using namespace std; void Solve(int N) { vector<int>res; if(N==1){ res.push_back(1); Answer(res); } else{ int primero; vector<int>l(N,1); for(int i=0;i<N;i++){ l[i]--; if(Query(l)==1){ primero=i+1; res[0]=primero; l[i]++; break; } l[i]++; } vector<bool>c(N,false); c[primero-1]=true; while(res.size()<N){ vector<int>libres; for(int i=0;i<N;i++){ if(!c[i])libres.push_back(i); } int low=0,hi=libres.size(); l.assign(N,0); while(low<=hi){ int mid=low+(hi-low)/2; for(int i=low;i<hi;i++)l[libres[i]]++; int v=Query(l); l[res[res.size()-1]]++; if(v==Query(l)){ hi=mid; } else{ low=mid+1; } } res.push_back(libres[low]+1); c[libres[low]]=true; } Answer(res); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 328 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 328 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |