# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080235 | 2024-08-29T08:12:38 Z | Tozzyyyy | Library (JOI18_library) | C++14 | 372 ms | 1004 KB |
#include <cstdio> #include <vector> #include "library.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 2000; vector<int> adj[MAXN]; vector<int> res; int vs[MAXN]; void dfs(int u){ vs[u] = 1; res.push_back(u); for(auto x : adj[u]) if(vs[x] == 0) dfs(x); } void Solve(int n) { int cur = 1; int cnt = 0; vector<int> check(n+1); while(cnt < n - 1){ vector<int> t; for(int j = 1 ; j <= n ; j++){ if(cur == j or check[j]) continue; t.push_back(j); } int l = 0 , r = t.size()-1; int res = -1; while(l <= r){ int mid = l + r >> 1; vector<int> m(n); for(int j = l ; j <=mid ; j++) m[t[j] - 1] = 1; int c1 = Query(m); m[cur-1] = 1; int c2 = Query(m); if(c2 <= c1) res = mid , r = mid-1; else l = mid+1; } if(res == -1){ check[cur] = 1; cur = 1; }else{ check[cur] = 1; res = t[res]; adj[cur].push_back(res); adj[res].push_back(cur); cur = res, cnt++; } } int t , mn = 2000; for(int i = 1; i <= n ; i++){ if(adj[i].size() < mn){ mn = adj[i].size(); t = i; } } dfs(t); Answer(res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 480 KB | # of queries: 2418 |
2 | Correct | 20 ms | 472 KB | # of queries: 2380 |
3 | Correct | 26 ms | 724 KB | # of queries: 2536 |
4 | Correct | 19 ms | 496 KB | # of queries: 2540 |
5 | Correct | 28 ms | 472 KB | # of queries: 2534 |
6 | Correct | 28 ms | 852 KB | # of queries: 2538 |
7 | Correct | 37 ms | 472 KB | # of queries: 2512 |
8 | Correct | 25 ms | 728 KB | # of queries: 2426 |
9 | Correct | 41 ms | 344 KB | # of queries: 2524 |
10 | Correct | 13 ms | 344 KB | # of queries: 1480 |
11 | Correct | 0 ms | 344 KB | # of queries: 0 |
12 | Correct | 0 ms | 344 KB | # of queries: 2 |
13 | Correct | 0 ms | 596 KB | # of queries: 6 |
14 | Correct | 0 ms | 344 KB | # of queries: 8 |
15 | Correct | 1 ms | 344 KB | # of queries: 78 |
16 | Correct | 2 ms | 344 KB | # of queries: 192 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 480 KB | # of queries: 2418 |
2 | Correct | 20 ms | 472 KB | # of queries: 2380 |
3 | Correct | 26 ms | 724 KB | # of queries: 2536 |
4 | Correct | 19 ms | 496 KB | # of queries: 2540 |
5 | Correct | 28 ms | 472 KB | # of queries: 2534 |
6 | Correct | 28 ms | 852 KB | # of queries: 2538 |
7 | Correct | 37 ms | 472 KB | # of queries: 2512 |
8 | Correct | 25 ms | 728 KB | # of queries: 2426 |
9 | Correct | 41 ms | 344 KB | # of queries: 2524 |
10 | Correct | 13 ms | 344 KB | # of queries: 1480 |
11 | Correct | 0 ms | 344 KB | # of queries: 0 |
12 | Correct | 0 ms | 344 KB | # of queries: 2 |
13 | Correct | 0 ms | 596 KB | # of queries: 6 |
14 | Correct | 0 ms | 344 KB | # of queries: 8 |
15 | Correct | 1 ms | 344 KB | # of queries: 78 |
16 | Correct | 2 ms | 344 KB | # of queries: 192 |
17 | Correct | 331 ms | 752 KB | # of queries: 17184 |
18 | Correct | 372 ms | 756 KB | # of queries: 16946 |
19 | Correct | 306 ms | 500 KB | # of queries: 17164 |
20 | Correct | 302 ms | 752 KB | # of queries: 15984 |
21 | Correct | 250 ms | 740 KB | # of queries: 15070 |
22 | Correct | 315 ms | 504 KB | # of queries: 17206 |
23 | Correct | 343 ms | 496 KB | # of queries: 17162 |
24 | Correct | 104 ms | 480 KB | # of queries: 7868 |
25 | Correct | 361 ms | 1004 KB | # of queries: 16754 |
26 | Correct | 254 ms | 492 KB | # of queries: 15658 |
27 | Correct | 109 ms | 732 KB | # of queries: 7774 |
28 | Correct | 284 ms | 744 KB | # of queries: 15974 |
29 | Correct | 323 ms | 740 KB | # of queries: 15956 |
30 | Correct | 366 ms | 736 KB | # of queries: 15974 |