# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
529114 | 2022-02-22T07:06:33 Z | ftkbrian | 도서관 (JOI18_library) | C++14 | 56 ms | 296 KB |
#include <bits/stdc++.h> #include "library.h" using namespace std; vector<int> now,lef; int chk[1010]; void Solve(int N) { vector<int> Qur(N,0); for(int i = 0 ; i < N ; i++) { for(int q = 0 ; q < N ; q++) if(q == i) Qur[q] = 0; else Qur[q] = 1; if(Query(Qur) == 1) { now.push_back(i); break; } } if(N >= 2) { for(int i = 0 ; i < N ; i++) Qur[i] = 0; Qur[now[0]] = 1; for(int i = 0 ; i < N ; i++) { if(i == now[0]) continue; Qur[i] = 1; if(Query(Qur) == 1) { now.push_back(i); break; } Qur[i] = 0; } } for(auto i : now) chk[i] = 1; for(int i = 0 ; i < N ; i++) if(!chk[i]) lef.push_back(i); ///현재 now에 들어있는 놈이 왼쪽 끝이라 하고 문제를 해결할 것 for(int i = 2 ; i < N ; i++) { int lo = 0,hi = lef.size()-1,loc; while(lo <= hi) { int mi = lo+hi>>1; for(int q = 0 ; q < N ; q++) Qur[q] = 0; for(auto q : now) Qur[q] = 1; for(int q = lo ; q <= mi ; q++) Qur[lef[q]] = 1; int tar = Query(Qur); Qur[now.back()] = 0; int tar2 = Query(Qur); if(tar != tar2) hi = mi-1,loc = mi; else lo = mi+1; } now.push_back(lef[loc]); swap(lef[loc],lef.back()); lef.pop_back(); } for(auto& i : now) i++; Answer(now); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 200 KB | # of queries: 2387 |
2 | Correct | 39 ms | 276 KB | # of queries: 2618 |
3 | Correct | 39 ms | 284 KB | # of queries: 2662 |
4 | Correct | 42 ms | 284 KB | # of queries: 2742 |
5 | Correct | 30 ms | 296 KB | # of queries: 2598 |
6 | Correct | 43 ms | 288 KB | # of queries: 2744 |
7 | Correct | 40 ms | 292 KB | # of queries: 2728 |
8 | Correct | 36 ms | 200 KB | # of queries: 2571 |
9 | Correct | 56 ms | 200 KB | # of queries: 2662 |
10 | Correct | 15 ms | 296 KB | # of queries: 1540 |
11 | Runtime error | 0 ms | 200 KB | Execution killed with signal 13 |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 200 KB | # of queries: 2387 |
2 | Correct | 39 ms | 276 KB | # of queries: 2618 |
3 | Correct | 39 ms | 284 KB | # of queries: 2662 |
4 | Correct | 42 ms | 284 KB | # of queries: 2742 |
5 | Correct | 30 ms | 296 KB | # of queries: 2598 |
6 | Correct | 43 ms | 288 KB | # of queries: 2744 |
7 | Correct | 40 ms | 292 KB | # of queries: 2728 |
8 | Correct | 36 ms | 200 KB | # of queries: 2571 |
9 | Correct | 56 ms | 200 KB | # of queries: 2662 |
10 | Correct | 15 ms | 296 KB | # of queries: 1540 |
11 | Runtime error | 0 ms | 200 KB | Execution killed with signal 13 |
12 | Halted | 0 ms | 0 KB | - |