# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1080164 | 2024-08-29T07:36:45 Z | vjudge1 | 도서관 (JOI18_library) | C++17 | 227 ms | 684 KB |
#include <iostream> #include <vector> #include <assert.h> #include "library.h" using namespace std; int dd[1005]; /*int Query(vector<int> v) { for (int w : v) cout << w << " "; cout << endl; int x; cin >> x; return x; } void Answer(vector<int> v) { for (int w : v) cout << w << " "; cout << endl; }*/ void Solve(int n) { if (n == 1) { Answer({1}); return; } for (int i = 0; i < n; i++) dd[i] = 0; vector<int> res; for (int i = 0; i < n; i++) { vector<int> vv; for (int j = 0; j < n; j++) { if (i == j) vv.push_back(0); else vv.push_back(1); } if (Query(vv) == 1) { res.push_back(i); break; } } for (int i = 0; i < n; i++) { if (i == res.back()) continue; vector<int> vv; for (int j = 0; j < n; j++) { if (j == i || j == res.back()) vv.push_back(1); else vv.push_back(0); } if (Query(vv) == 1) { res.push_back(i); break; } } assert(res.size() == 2); dd[res[0]] = dd[res[1]] = 1; for (int i = 2; i < n; i++) { vector<int> v; for (int j = 0; j < n; j++) { if (dd[j] == 0) { v.push_back(j); } } int l = 0, r = v.size() - 2, g = v.size() - 1; while (l <= r) { int mid = (l + r) / 2; vector<int> vv(n, 0); for (int j = 0; j <= mid; j++) vv[v[j]] = 1; for (int j = 0; j < res.size(); j++) vv[res[j]] = 1; int h = Query(vv); vv[res.back()] = 0; int k = Query(vv); if (h != k) { g = mid; r = mid - 1; } else l = mid + 1; } res.push_back(v[g]); dd[v[g]] = 1; } for (int &w : res) w++; Answer(res); } /*int main() { Solve(5); }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 344 KB | # of queries: 2367 |
2 | Correct | 25 ms | 344 KB | # of queries: 2570 |
3 | Correct | 24 ms | 344 KB | # of queries: 2668 |
4 | Correct | 33 ms | 344 KB | # of queries: 2740 |
5 | Correct | 22 ms | 344 KB | # of queries: 2600 |
6 | Correct | 23 ms | 344 KB | # of queries: 2726 |
7 | Correct | 24 ms | 344 KB | # of queries: 2708 |
8 | Correct | 20 ms | 344 KB | # of queries: 2575 |
9 | Correct | 26 ms | 344 KB | # of queries: 2662 |
10 | Correct | 16 ms | 344 KB | # of queries: 1534 |
11 | Correct | 1 ms | 344 KB | # of queries: 0 |
12 | Correct | 0 ms | 344 KB | # of queries: 2 |
13 | Correct | 1 ms | 344 KB | # of queries: 3 |
14 | Correct | 0 ms | 344 KB | # of queries: 5 |
15 | Correct | 1 ms | 344 KB | # of queries: 79 |
16 | Correct | 2 ms | 344 KB | # of queries: 192 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 344 KB | # of queries: 2367 |
2 | Correct | 25 ms | 344 KB | # of queries: 2570 |
3 | Correct | 24 ms | 344 KB | # of queries: 2668 |
4 | Correct | 33 ms | 344 KB | # of queries: 2740 |
5 | Correct | 22 ms | 344 KB | # of queries: 2600 |
6 | Correct | 23 ms | 344 KB | # of queries: 2726 |
7 | Correct | 24 ms | 344 KB | # of queries: 2708 |
8 | Correct | 20 ms | 344 KB | # of queries: 2575 |
9 | Correct | 26 ms | 344 KB | # of queries: 2662 |
10 | Correct | 16 ms | 344 KB | # of queries: 1534 |
11 | Correct | 1 ms | 344 KB | # of queries: 0 |
12 | Correct | 0 ms | 344 KB | # of queries: 2 |
13 | Correct | 1 ms | 344 KB | # of queries: 3 |
14 | Correct | 0 ms | 344 KB | # of queries: 5 |
15 | Correct | 1 ms | 344 KB | # of queries: 79 |
16 | Correct | 2 ms | 344 KB | # of queries: 192 |
17 | Correct | 227 ms | 424 KB | # of queries: 18495 |
18 | Correct | 202 ms | 596 KB | # of queries: 18249 |
19 | Correct | 219 ms | 344 KB | # of queries: 17590 |
20 | Correct | 196 ms | 424 KB | # of queries: 17148 |
21 | Correct | 192 ms | 424 KB | # of queries: 16194 |
22 | Correct | 213 ms | 680 KB | # of queries: 18259 |
23 | Correct | 222 ms | 340 KB | # of queries: 18188 |
24 | Correct | 109 ms | 424 KB | # of queries: 8235 |
25 | Correct | 217 ms | 428 KB | # of queries: 17736 |
26 | Correct | 191 ms | 344 KB | # of queries: 16233 |
27 | Correct | 82 ms | 344 KB | # of queries: 8526 |
28 | Correct | 170 ms | 684 KB | # of queries: 15940 |
29 | Correct | 186 ms | 680 KB | # of queries: 15922 |
30 | Correct | 184 ms | 448 KB | # of queries: 15940 |