# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815868 | 2023-08-09T01:46:44 Z | Pikachu | Carnival (CEOI14_carnival) | C++17 | 77 ms | 316 KB |
#include <bits/stdc++.h> using namespace std; template<typename T> inline bool maxi(T &x, const T &val) { if (x < val) return x = val, true; return false; } template<typename T> inline bool mini(T &x, const T &val) { if (x > val) return x = val, true; return false; } const int maxn = 155; int n; int ans[maxn]; int par[maxn]; int findpar(int x) { if (par[x]) return par[x] = findpar(par[x]); return x; } void unite(int u, int v) { u = findpar(u); v = findpar(v); if (u != v) par[u] = v; } int getInt() { int tmp; cin >> tmp; return tmp; } void solve() { cin >> n; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { cout << 2 << ' ' << i << ' ' << j << endl; if (getInt() == 1) unite(i, j); } } int cnt = 0; for (int i = 1; i <= n; i++) { int x = findpar(i); if (ans[x]) ans[i] = ans[x]; else { ans[i] = ans[x] = ++cnt; } } cout << "0 "; for (int i = 1; i <= n; i++) cout << ans[i] << ' '; cout << endl; } signed main() { #ifdef LOCAL clock_t st = clock(); #endif ios_base::sync_with_stdio(false); cin.tie(0); #define Task "" #ifdef LOCAL if (!fopen("D:\\.inp", "r")) { freopen("D:\\.inp", "w", stdout); freopen("D:\\.out", "w", stdout); cerr << "get input from file\n"; return 0; } freopen("D:\\.inp", "r", stdin); freopen("D:\\.out", "w", stdout); #else if (fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } #endif solve(); #ifdef LOCAL cerr << clock() - st << endl; #endif }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 77 ms | 208 KB | Partially correct |
2 | Partially correct | 50 ms | 208 KB | Partially correct |
3 | Partially correct | 50 ms | 208 KB | Partially correct |
4 | Partially correct | 52 ms | 208 KB | Partially correct |
5 | Partially correct | 56 ms | 208 KB | Partially correct |
6 | Partially correct | 62 ms | 208 KB | Partially correct |
7 | Partially correct | 56 ms | 208 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 52 ms | 208 KB | Partially correct |
2 | Partially correct | 57 ms | 208 KB | Partially correct |
3 | Partially correct | 44 ms | 208 KB | Partially correct |
4 | Partially correct | 56 ms | 208 KB | Partially correct |
5 | Partially correct | 65 ms | 208 KB | Partially correct |
6 | Partially correct | 50 ms | 208 KB | Partially correct |
7 | Partially correct | 34 ms | 316 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 60 ms | 208 KB | Partially correct |
2 | Partially correct | 60 ms | 208 KB | Partially correct |
3 | Partially correct | 56 ms | 208 KB | Partially correct |
4 | Partially correct | 47 ms | 208 KB | Partially correct |
5 | Partially correct | 62 ms | 208 KB | Partially correct |
6 | Partially correct | 72 ms | 208 KB | Partially correct |
7 | Partially correct | 60 ms | 208 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 60 ms | 208 KB | Partially correct |
2 | Partially correct | 62 ms | 208 KB | Partially correct |
3 | Partially correct | 58 ms | 208 KB | Partially correct |
4 | Partially correct | 77 ms | 208 KB | Partially correct |
5 | Partially correct | 68 ms | 208 KB | Partially correct |
6 | Partially correct | 57 ms | 208 KB | Partially correct |
7 | Partially correct | 76 ms | 208 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 77 ms | 208 KB | Partially correct |
2 | Partially correct | 67 ms | 208 KB | Partially correct |
3 | Partially correct | 65 ms | 208 KB | Partially correct |
4 | Partially correct | 59 ms | 208 KB | Partially correct |
5 | Partially correct | 33 ms | 208 KB | Partially correct |
6 | Partially correct | 66 ms | 208 KB | Partially correct |
7 | Partially correct | 65 ms | 208 KB | Partially correct |