# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
401480 | 2021-05-10T11:22:34 Z | victoriad | Library (JOI18_library) | C++14 | 402 ms | 320 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(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 | 162 ms | 284 KB | # of queries: 9480 |
2 | Correct | 156 ms | 320 KB | # of queries: 9357 |
3 | Correct | 145 ms | 280 KB | # of queries: 10412 |
4 | Correct | 114 ms | 288 KB | # of queries: 10236 |
5 | Correct | 171 ms | 296 KB | # of queries: 10304 |
6 | Correct | 133 ms | 284 KB | # of queries: 9922 |
7 | Correct | 170 ms | 200 KB | # of queries: 10083 |
8 | Correct | 158 ms | 280 KB | # of queries: 9200 |
9 | Correct | 187 ms | 288 KB | # of queries: 10388 |
10 | Correct | 79 ms | 200 KB | # of queries: 4371 |
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: 63 |
16 | Correct | 4 ms | 200 KB | # of queries: 222 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 284 KB | # of queries: 9480 |
2 | Correct | 156 ms | 320 KB | # of queries: 9357 |
3 | Correct | 145 ms | 280 KB | # of queries: 10412 |
4 | Correct | 114 ms | 288 KB | # of queries: 10236 |
5 | Correct | 171 ms | 296 KB | # of queries: 10304 |
6 | Correct | 133 ms | 284 KB | # of queries: 9922 |
7 | Correct | 170 ms | 200 KB | # of queries: 10083 |
8 | Correct | 158 ms | 280 KB | # of queries: 9200 |
9 | Correct | 187 ms | 288 KB | # of queries: 10388 |
10 | Correct | 79 ms | 200 KB | # of queries: 4371 |
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: 63 |
16 | Correct | 4 ms | 200 KB | # of queries: 222 |
17 | Runtime error | 402 ms | 312 KB | Execution killed with signal 13 |
18 | Halted | 0 ms | 0 KB | - |