# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49060 | 2018-05-21T14:47:46 Z | Namnamseo | Library (JOI18_library) | C++17 | 594 ms | 592 KB |
#include <cstdio> #include <vector> #include "library.h" using namespace std; int nok[1010], nn; void Solve(int N) { vector<int> M(N, 1); if(N == 1){ Answer(M); return; } int left; for(left = 0; left < N; ++left){ M[left] = 0; if(Query(M) == 1) break; M[left] = 1; } vector<int> ans(N); ans[0]=left+1; for(int i=0; i<N; ++i) if(i != left) nok[nn++] = i; fill(M.begin(), M.end(), 0); for(int i=1; i<N; ++i){ int l=0, r=nn; while(l+1 < r){ int mid=(l+r)/2; for(int i=l; i<mid; ++i) M[nok[i]] = 1; int res1 = Query(M); M[ans[i-1]-1] = 1; int res2 = Query(M); for(int i=l; i<mid; ++i) M[nok[i]] = 0; M[ans[i-1]-1]=0; if(res1 == res2) r=mid; else l=mid; } ans[i] = nok[l]+1; swap(nok[nn-1], nok[l]); --nn; } Answer(ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 416 KB | Output is correct |
2 | Correct | 30 ms | 416 KB | Output is correct |
3 | Correct | 38 ms | 416 KB | Output is correct |
4 | Correct | 44 ms | 416 KB | Output is correct |
5 | Correct | 64 ms | 444 KB | Output is correct |
6 | Correct | 37 ms | 444 KB | Output is correct |
7 | Correct | 42 ms | 496 KB | Output is correct |
8 | Correct | 27 ms | 496 KB | Output is correct |
9 | Correct | 56 ms | 496 KB | Output is correct |
10 | Correct | 34 ms | 496 KB | Output is correct |
11 | Correct | 2 ms | 496 KB | Output is correct |
12 | Correct | 2 ms | 496 KB | Output is correct |
13 | Correct | 2 ms | 552 KB | Output is correct |
14 | Correct | 4 ms | 552 KB | Output is correct |
15 | Correct | 4 ms | 552 KB | Output is correct |
16 | Correct | 5 ms | 552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 416 KB | Output is correct |
2 | Correct | 30 ms | 416 KB | Output is correct |
3 | Correct | 38 ms | 416 KB | Output is correct |
4 | Correct | 44 ms | 416 KB | Output is correct |
5 | Correct | 64 ms | 444 KB | Output is correct |
6 | Correct | 37 ms | 444 KB | Output is correct |
7 | Correct | 42 ms | 496 KB | Output is correct |
8 | Correct | 27 ms | 496 KB | Output is correct |
9 | Correct | 56 ms | 496 KB | Output is correct |
10 | Correct | 34 ms | 496 KB | Output is correct |
11 | Correct | 2 ms | 496 KB | Output is correct |
12 | Correct | 2 ms | 496 KB | Output is correct |
13 | Correct | 2 ms | 552 KB | Output is correct |
14 | Correct | 4 ms | 552 KB | Output is correct |
15 | Correct | 4 ms | 552 KB | Output is correct |
16 | Correct | 5 ms | 552 KB | Output is correct |
17 | Correct | 403 ms | 572 KB | Output is correct |
18 | Correct | 416 ms | 572 KB | Output is correct |
19 | Correct | 391 ms | 572 KB | Output is correct |
20 | Correct | 372 ms | 572 KB | Output is correct |
21 | Correct | 420 ms | 572 KB | Output is correct |
22 | Correct | 524 ms | 572 KB | Output is correct |
23 | Correct | 459 ms | 588 KB | Output is correct |
24 | Correct | 179 ms | 588 KB | Output is correct |
25 | Correct | 471 ms | 592 KB | Output is correct |
26 | Correct | 426 ms | 592 KB | Output is correct |
27 | Correct | 231 ms | 592 KB | Output is correct |
28 | Correct | 594 ms | 592 KB | Output is correct |
29 | Correct | 476 ms | 592 KB | Output is correct |
30 | Correct | 487 ms | 592 KB | Output is correct |