# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160081 | 2019-10-26T00:22:55 Z | combi1k1 | Library (JOI18_library) | C++14 | 712 ms | 632 KB |
#include<bits/stdc++.h> #include "library.h" using namespace std; vector<int> ASK; /*int Query(vector<int> v) { for(int x : v) cout << x << ' '; cout << '\n'; int x; cin >> x; return x; } int Answer(vector<int> v) { for(int x : v) cout << x << ' '; }*/ int ask(vector<int> v) { if (v.size() == 1) return 1; for(int &x : ASK) x = 0; for(int &x : v) ASK[x - 1] = 1; return Query(ASK); } int Connected(int u,vector<int> v) { int a = ask(v); v.push_back(u); int b = ask(v); return a >= b; } vector<int> g[1001]; void Solve(int n) { if (n == 1) { Answer({1}); return; } if (n == 2) { Answer({1,2}); return; } ASK.resize(n); for(int i = 1 ; i <= n ; ++i) { vector<int> v; int x = i; int y = 0; if (g[i].size() == 1) y = g[i][0]; if (g[i].size() == 2) continue; for(int j = 1 ; j <= n ; ++j) if (j != x && j != y) v.push_back(j); int l = 1; int r = v.size() + 1; for(; l < r ;) { int m = (l + r) / 2; if (Connected(i,vector<int>(v.begin(),v.begin() + m))) r = m; else l = m + 1; } if (l <= v.size()) { x = v[l - 1]; //cout << x << " sieu to khong lo\n"; g[i].push_back(x); g[x].push_back(i); } } vector<int> res; for(int i = 1 ; i <= n ; ++i) if (g[i].size() == 1) { int x = i; for(int j = 0 ; j < n ; ++j) for(int u : g[x]) if (res.empty() || u != res.back()) { res.push_back(x); x = u; break; } res.push_back(x); Answer(res); return; } } /*int main() { int n; cin >> n; Solve(n); }*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 55 ms | 248 KB | Wrong Answer [4] |
2 | Incorrect | 43 ms | 344 KB | Wrong Answer [4] |
3 | Incorrect | 49 ms | 248 KB | Wrong Answer [4] |
4 | Incorrect | 91 ms | 248 KB | Wrong Answer [4] |
5 | Incorrect | 37 ms | 336 KB | Wrong Answer [4] |
6 | Incorrect | 57 ms | 344 KB | Wrong Answer [4] |
7 | Incorrect | 55 ms | 376 KB | Wrong Answer [4] |
8 | Incorrect | 57 ms | 376 KB | Wrong Answer [4] |
9 | Incorrect | 54 ms | 424 KB | Wrong Answer [4] |
10 | Incorrect | 27 ms | 464 KB | Wrong Answer [4] |
11 | Correct | 2 ms | 248 KB | # of queries: 0 |
12 | Correct | 2 ms | 376 KB | # of queries: 0 |
13 | Correct | 2 ms | 376 KB | # of queries: 7 |
14 | Correct | 2 ms | 376 KB | # of queries: 9 |
15 | Correct | 12 ms | 376 KB | # of queries: 111 |
16 | Incorrect | 4 ms | 332 KB | Wrong Answer [4] |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 55 ms | 248 KB | Wrong Answer [4] |
2 | Incorrect | 43 ms | 344 KB | Wrong Answer [4] |
3 | Incorrect | 49 ms | 248 KB | Wrong Answer [4] |
4 | Incorrect | 91 ms | 248 KB | Wrong Answer [4] |
5 | Incorrect | 37 ms | 336 KB | Wrong Answer [4] |
6 | Incorrect | 57 ms | 344 KB | Wrong Answer [4] |
7 | Incorrect | 55 ms | 376 KB | Wrong Answer [4] |
8 | Incorrect | 57 ms | 376 KB | Wrong Answer [4] |
9 | Incorrect | 54 ms | 424 KB | Wrong Answer [4] |
10 | Incorrect | 27 ms | 464 KB | Wrong Answer [4] |
11 | Correct | 2 ms | 248 KB | # of queries: 0 |
12 | Correct | 2 ms | 376 KB | # of queries: 0 |
13 | Correct | 2 ms | 376 KB | # of queries: 7 |
14 | Correct | 2 ms | 376 KB | # of queries: 9 |
15 | Correct | 12 ms | 376 KB | # of queries: 111 |
16 | Incorrect | 4 ms | 332 KB | Wrong Answer [4] |
17 | Incorrect | 584 ms | 624 KB | Wrong Answer [4] |
18 | Incorrect | 553 ms | 380 KB | Wrong Answer [4] |
19 | Incorrect | 585 ms | 428 KB | Wrong Answer [4] |
20 | Incorrect | 619 ms | 508 KB | Wrong Answer [4] |
21 | Incorrect | 465 ms | 424 KB | Wrong Answer [4] |
22 | Incorrect | 617 ms | 600 KB | Wrong Answer [4] |
23 | Incorrect | 561 ms | 612 KB | Wrong Answer [4] |
24 | Incorrect | 215 ms | 380 KB | Wrong Answer [4] |
25 | Incorrect | 582 ms | 512 KB | Wrong Answer [4] |
26 | Incorrect | 528 ms | 632 KB | Wrong Answer [4] |
27 | Incorrect | 198 ms | 432 KB | Wrong Answer [4] |
28 | Correct | 712 ms | 504 KB | # of queries: 19947 |
29 | Correct | 637 ms | 556 KB | # of queries: 19925 |
30 | Correct | 649 ms | 476 KB | # of queries: 19947 |