# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
230238 | 2020-05-09T09:35:46 Z | syy | Carnival (CEOI14_carnival) | C++17 | 14 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++) #define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--) typedef pair<int, int> pi; #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) int n, c, col[155], r; vector<int> v; int query(int x, int y, int z = 0) { cout << y-x+1+(z != 0)<< " "; while (x <= y) cout << v[x++] << " "; if (z) cout << z; cout << "\n"; cout.flush(); int res; cin >> res; return res; } int main() { fastio; cin >> n; FOR(i, 1, n) { v.pb(i); if (v.size() != query(0, v.size()-1)) v.pop_back(); } c = v.size(); FOR(i, 0, c-1) col[v[i]] = i+1; FOR(i, 1, n) if (!col[i]) { int lower = 0, upper = c-1; while (upper - lower > 1) { int mid = (upper + lower)/2; if (query(lower, mid, i) != mid-lower+2) upper = mid; else lower = mid+1; } cout << "2 " << v[lower] << " " << i << "\n"; cout.flush(); cin >> r; if (r == 1) col[i] = col[v[lower]]; else col[i] = col[v[upper]]; } FOR(i, 0, n) cout << col[i] << " "; cout << "\n"; cout.flush(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 384 KB | Output is correct |
2 | Correct | 12 ms | 384 KB | Output is correct |
3 | Correct | 9 ms | 384 KB | Output is correct |
4 | Correct | 7 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 384 KB | Output is correct |
7 | Correct | 11 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 384 KB | Output is correct |
2 | Correct | 11 ms | 256 KB | Output is correct |
3 | Correct | 8 ms | 384 KB | Output is correct |
4 | Correct | 7 ms | 384 KB | Output is correct |
5 | Correct | 10 ms | 384 KB | Output is correct |
6 | Correct | 8 ms | 384 KB | Output is correct |
7 | Correct | 9 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Output is correct |
2 | Correct | 9 ms | 384 KB | Output is correct |
3 | Correct | 11 ms | 384 KB | Output is correct |
4 | Correct | 7 ms | 384 KB | Output is correct |
5 | Correct | 10 ms | 384 KB | Output is correct |
6 | Correct | 11 ms | 384 KB | Output is correct |
7 | Correct | 12 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 384 KB | Output is correct |
2 | Correct | 10 ms | 384 KB | Output is correct |
3 | Correct | 8 ms | 360 KB | Output is correct |
4 | Correct | 7 ms | 384 KB | Output is correct |
5 | Correct | 12 ms | 384 KB | Output is correct |
6 | Correct | 10 ms | 384 KB | Output is correct |
7 | Correct | 14 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Output is correct |
2 | Correct | 10 ms | 384 KB | Output is correct |
3 | Correct | 12 ms | 384 KB | Output is correct |
4 | Correct | 10 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 384 KB | Output is correct |
6 | Correct | 9 ms | 384 KB | Output is correct |
7 | Correct | 8 ms | 384 KB | Output is correct |