# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
401615 | 2021-05-10T14:55:27 Z | victoriad | Library (JOI18_library) | C++14 | 368 ms | 308 KB |
#include <cstdio> #include <vector> #include "library.h" using namespace std; void Solve(int N) { vector<vector<int> >p(N); int f; for(int i=1;i<=N;i++){ if(p[i-1].size()<2){ for(int k=i+1;k<=N;k++){ vector<int> M(N,0); M[k-1]=1; M[i-1]=1; if(p[k-1].size()==2)continue; if(p[i-1].size()==1 && p[i-1][0]==k-1)continue; if(Query(M)==1){ p[i-1].push_back(k-1); p[k-1].push_back(i-1); } if(p[i-1].size()==2)break; } if(p[i-1].size()==1)f=i-1; } } vector<bool>c(N,false); vector<int> res(N); res[0]=f+1; c[f]=true; for(int i=1;i<N;i++){ for(int k=0;k<p[f].size();k++){ if(!c[p[f][k]]){ c[p[f][k]]=true; res[i]=p[f][k]+1; f=res[i]-1; break; } } } Answer(res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 193 ms | 296 KB | # of queries: 8277 |
2 | Correct | 131 ms | 200 KB | # of queries: 8239 |
3 | Correct | 142 ms | 200 KB | # of queries: 9230 |
4 | Correct | 96 ms | 288 KB | # of queries: 9178 |
5 | Correct | 145 ms | 288 KB | # of queries: 9216 |
6 | Correct | 148 ms | 300 KB | # of queries: 8800 |
7 | Correct | 118 ms | 288 KB | # of queries: 9069 |
8 | Correct | 143 ms | 200 KB | # of queries: 8272 |
9 | Correct | 113 ms | 300 KB | # of queries: 9253 |
10 | Correct | 55 ms | 276 KB | # of queries: 3883 |
11 | Correct | 1 ms | 200 KB | # of queries: 0 |
12 | Correct | 1 ms | 200 KB | # of queries: 1 |
13 | Correct | 1 ms | 200 KB | # of queries: 3 |
14 | Correct | 1 ms | 200 KB | # of queries: 5 |
15 | Correct | 2 ms | 200 KB | # of queries: 57 |
16 | Correct | 4 ms | 200 KB | # of queries: 210 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 193 ms | 296 KB | # of queries: 8277 |
2 | Correct | 131 ms | 200 KB | # of queries: 8239 |
3 | Correct | 142 ms | 200 KB | # of queries: 9230 |
4 | Correct | 96 ms | 288 KB | # of queries: 9178 |
5 | Correct | 145 ms | 288 KB | # of queries: 9216 |
6 | Correct | 148 ms | 300 KB | # of queries: 8800 |
7 | Correct | 118 ms | 288 KB | # of queries: 9069 |
8 | Correct | 143 ms | 200 KB | # of queries: 8272 |
9 | Correct | 113 ms | 300 KB | # of queries: 9253 |
10 | Correct | 55 ms | 276 KB | # of queries: 3883 |
11 | Correct | 1 ms | 200 KB | # of queries: 0 |
12 | Correct | 1 ms | 200 KB | # of queries: 1 |
13 | Correct | 1 ms | 200 KB | # of queries: 3 |
14 | Correct | 1 ms | 200 KB | # of queries: 5 |
15 | Correct | 2 ms | 200 KB | # of queries: 57 |
16 | Correct | 4 ms | 200 KB | # of queries: 210 |
17 | Runtime error | 368 ms | 308 KB | Execution killed with signal 13 |
18 | Halted | 0 ms | 0 KB | - |