# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25908 | 2017-06-25T05:37:41 Z | 김동현(#1086) | Carnival (CEOI14_carnival) | C++14 | 6 ms | 2024 KB |
#include <bits/stdc++.h> using namespace std; int n, p[151]; int fnd(int x){ return p[x] = (x == p[x] ? x : fnd(p[x])); } void uni(int x, int y){ p[fnd(x)] = fnd(y); } vector<int> f(int s, int e){ if(s == e){ vector<int> ret; ret.push_back(s); return ret; } vector<int> l = f(s, (s + e) / 2); vector<int> r = f((s + e) / 2 + 1, e); int rs = r.size(); vector<int> ret; for(auto &i : l){ printf("%d %d ", rs + 1, i); for(auto &j : r) printf("%d ", j); puts(""); fflush(stdout); int t; scanf("%d", &t); if(t == rs + 1){ ret.push_back(i); continue; } int s = 0, e = r.size() - 1; while(s < e){ int m = (s + e) / 2; printf("%d %d ", m - s + 2, i); for(int j = s; j <= m; j++) printf("%d ", r[j]); puts(""); fflush(stdout); scanf("%d", &t); if(t < m - s + 2) e = m; else s = m + 1; } uni(i, r[s]); } for(auto &i : r) ret.push_back(i); return ret; } int main(){ scanf("%d", &n); for(int i = 1; i <= n; i++) p[i] = i; f(1, n); set<int> ss; int cnt, c[151]; for(int i = 1; i <= n; i++){ if(ss.find(fnd(i)) != ss.end()) continue; ss.insert(fnd(i)); c[fnd(i)] = ++cnt; } for(int i = 1; i <= n; i++) printf("%d ", c[fnd(i)]); fflush(stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2024 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2024 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2024 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 2024 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |