# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815876 | 2023-08-09T01:52:58 Z | Pikachu | Carnival (CEOI14_carnival) | C++17 | 26 ms | 356 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]; bool last[maxn]; set<int> rem; int getint() { int tmp; cin >> tmp; return tmp; } int askrange(int l, int r) { cout << r - l + 1 << ' '; for (int i = l; i <= r; i++) { cout << i << ' '; } cout << endl; return getint(); } int askpair(int u, int v) { cout << 2 << ' ' << u << ' ' << v << endl; return getint(); } void erase(vector<int> &tmp) { for (int x : tmp) { rem.erase(x); } tmp.clear(); } void solve() { cin >> n; int cur = askrange(1, n); last[n] = true; for (int i = 1; i < n; i++) { if (askrange(i + 1, n) != cur) { last[i] = true; cur--; } else rem.insert(i); } int cnt = 0; vector<int> tmp; for (int i = 1; i <= n; i++) { if (last[i]) { ans[i] = ++cnt; for (int x : rem) { if (x > i) break; if (askpair(x, i) == 1) { ans[x] = cnt; tmp.push_back(x); } } erase(tmp); } } 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 | Correct | 8 ms | 208 KB | Output is correct |
2 | Correct | 16 ms | 256 KB | Output is correct |
3 | Correct | 10 ms | 312 KB | Output is correct |
4 | Correct | 6 ms | 208 KB | Output is correct |
5 | Correct | 6 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 316 KB | Output is correct |
7 | Correct | 13 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 248 KB | Output is correct |
2 | Correct | 13 ms | 316 KB | Output is correct |
3 | Correct | 5 ms | 208 KB | Output is correct |
4 | Correct | 7 ms | 208 KB | Output is correct |
5 | Correct | 13 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 320 KB | Output is correct |
7 | Correct | 12 ms | 316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 208 KB | Output is correct |
2 | Correct | 5 ms | 320 KB | Output is correct |
3 | Correct | 13 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 21 ms | 320 KB | Output is correct |
6 | Correct | 9 ms | 356 KB | Output is correct |
7 | Correct | 22 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 320 KB | Output is correct |
2 | Correct | 3 ms | 208 KB | Output is correct |
3 | Correct | 12 ms | 208 KB | Output is correct |
4 | Correct | 4 ms | 208 KB | Output is correct |
5 | Correct | 14 ms | 208 KB | Output is correct |
6 | Correct | 26 ms | 236 KB | Output is correct |
7 | Correct | 16 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 8 ms | 208 KB | Output is correct |
3 | Correct | 15 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 316 KB | Output is correct |
5 | Correct | 20 ms | 208 KB | Output is correct |
6 | Correct | 20 ms | 208 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |