# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
649611 | 2022-10-11T03:56:12 Z | PoonYaPat | 도서관 (JOI18_library) | C++14 | 1010 ms | 57720 KB |
#include <bits/stdc++.h> #include "library.h" using namespace std; map<vector<int> ,int> have; int query(vector<int> x) { bool check=false; for (int i=0; i<x.size(); ++i) if (x[i]) check=true; if (!check) return -1; else { if (!have[x]) have[x]=Query(x); return have[x]; } } void Solve(int n) { int now=-1,pre=-1,ed; vector<int> test,ans; if (n==1) { ans.push_back(1); Answer(ans); return ; } for (int i=0; i<n; ++i) test.push_back(1); for (int i=0; i<n; ++i) { test[i]=0; if (query(test)==1) { if (now==-1) now=i; else ed=i; } test[i]=1; } ans.push_back(now+1); for (int i=0; i<n-1; ++i) { int l=0, r=n-1; while (l<r) { int mid=(l+r)/2; for (int i=0; i<n; ++i) { if (i==pre) test[i]=0; else if (i>=mid+1 && i<=r) test[i]=1; else test[i]=0; } int k1=query(test); test[now]=1-test[now]; int k2=query(test); if (k1==k2) l=mid+1; else r=mid; } ans.push_back(r+1); pre=now; now=r; } Answer(ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 1864 KB | # of queries: 1971 |
2 | Correct | 44 ms | 1872 KB | # of queries: 1923 |
3 | Correct | 44 ms | 2092 KB | # of queries: 2070 |
4 | Correct | 47 ms | 1992 KB | # of queries: 2040 |
5 | Correct | 49 ms | 2040 KB | # of queries: 2048 |
6 | Correct | 45 ms | 1976 KB | # of queries: 2059 |
7 | Correct | 51 ms | 2004 KB | # of queries: 2044 |
8 | Correct | 42 ms | 1892 KB | # of queries: 1967 |
9 | Correct | 50 ms | 2040 KB | # of queries: 2033 |
10 | Correct | 21 ms | 968 KB | # of queries: 1221 |
11 | Correct | 0 ms | 208 KB | # of queries: 0 |
12 | Correct | 0 ms | 208 KB | # of queries: 3 |
13 | Correct | 1 ms | 208 KB | # of queries: 5 |
14 | Correct | 1 ms | 208 KB | # of queries: 10 |
15 | Correct | 2 ms | 208 KB | # of queries: 88 |
16 | Correct | 4 ms | 336 KB | # of queries: 185 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 1864 KB | # of queries: 1971 |
2 | Correct | 44 ms | 1872 KB | # of queries: 1923 |
3 | Correct | 44 ms | 2092 KB | # of queries: 2070 |
4 | Correct | 47 ms | 1992 KB | # of queries: 2040 |
5 | Correct | 49 ms | 2040 KB | # of queries: 2048 |
6 | Correct | 45 ms | 1976 KB | # of queries: 2059 |
7 | Correct | 51 ms | 2004 KB | # of queries: 2044 |
8 | Correct | 42 ms | 1892 KB | # of queries: 1967 |
9 | Correct | 50 ms | 2040 KB | # of queries: 2033 |
10 | Correct | 21 ms | 968 KB | # of queries: 1221 |
11 | Correct | 0 ms | 208 KB | # of queries: 0 |
12 | Correct | 0 ms | 208 KB | # of queries: 3 |
13 | Correct | 1 ms | 208 KB | # of queries: 5 |
14 | Correct | 1 ms | 208 KB | # of queries: 10 |
15 | Correct | 2 ms | 208 KB | # of queries: 88 |
16 | Correct | 4 ms | 336 KB | # of queries: 185 |
17 | Correct | 776 ms | 50652 KB | # of queries: 12566 |
18 | Correct | 728 ms | 49604 KB | # of queries: 12438 |
19 | Correct | 788 ms | 51048 KB | # of queries: 12588 |
20 | Correct | 695 ms | 44788 KB | # of queries: 11794 |
21 | Correct | 670 ms | 40068 KB | # of queries: 11095 |
22 | Correct | 778 ms | 50736 KB | # of queries: 12563 |
23 | Correct | 750 ms | 50700 KB | # of queries: 12590 |
24 | Correct | 213 ms | 12788 KB | # of queries: 5954 |
25 | Correct | 667 ms | 48612 KB | # of queries: 12292 |
26 | Correct | 688 ms | 43144 KB | # of queries: 11572 |
27 | Correct | 211 ms | 12772 KB | # of queries: 5928 |
28 | Correct | 1010 ms | 57720 KB | # of queries: 14332 |
29 | Correct | 955 ms | 57544 KB | # of queries: 14316 |
30 | Correct | 942 ms | 57628 KB | # of queries: 14332 |