# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784158 | 2023-07-15T19:27:14 Z | jnjwnwnw | Carnival (CEOI14_carnival) | C++11 | 22 ms | 316 KB |
#include <iostream> #include <algorithm> #include <string> #include <set> using namespace std; void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } #define MAXN 151 int n; set<int> groups[MAXN]; int ans[MAXN]; int main(){ cin >> n; int group = 0; int prev = 0; for(int i = 1; i <= n; i++){ cout << i; for(int j = 1; j <= i; j++){ cout << " " << j; } cout << endl; int cur; cin >> cur; if (cur != prev){ groups[group++].insert(i); } prev = cur; } int numGroups = group; group = 0; int temp; for(int i = 1; i <= n; i++){ if (groups[group].find(i) != groups[group].end()){ // already has, so next group group++; }else{ // need to find a group to keep this in; for(int j = 0; j < group; j++){ cout << 2 << " " << (*groups[j].upper_bound(0)) << " " << i << endl; cin >> temp; if (temp == 1){ // found our spot groups[j].insert(i); break; } } } } for(int i = 0; i < numGroups; i++){ for(int j: groups[i]){ ans[j] = i+1; } } cout << 0; for(int i = 1; i <= n; i++){ cout << " " << ans[i]; } cout << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 316 KB | Output is correct |
2 | Correct | 9 ms | 208 KB | Output is correct |
3 | Correct | 14 ms | 312 KB | Output is correct |
4 | Correct | 4 ms | 308 KB | Output is correct |
5 | Correct | 4 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 208 KB | Output is correct |
7 | Correct | 6 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 308 KB | Output is correct |
2 | Correct | 17 ms | 208 KB | Output is correct |
3 | Correct | 10 ms | 308 KB | Output is correct |
4 | Correct | 7 ms | 308 KB | Output is correct |
5 | Correct | 4 ms | 304 KB | Output is correct |
6 | Correct | 2 ms | 312 KB | Output is correct |
7 | Correct | 7 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 208 KB | Output is correct |
2 | Correct | 7 ms | 312 KB | Output is correct |
3 | Correct | 22 ms | 292 KB | Output is correct |
4 | Correct | 4 ms | 208 KB | Output is correct |
5 | Correct | 3 ms | 308 KB | Output is correct |
6 | Correct | 2 ms | 208 KB | Output is correct |
7 | Correct | 14 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 208 KB | Output is correct |
2 | Correct | 4 ms | 208 KB | Output is correct |
3 | Correct | 11 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 4 ms | 208 KB | Output is correct |
6 | Correct | 5 ms | 312 KB | Output is correct |
7 | Correct | 13 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 11 ms | 308 KB | Output is correct |
3 | Correct | 19 ms | 208 KB | Output is correct |
4 | Correct | 13 ms | 208 KB | Output is correct |
5 | Correct | 4 ms | 308 KB | Output is correct |
6 | Correct | 2 ms | 280 KB | Output is correct |
7 | Correct | 8 ms | 308 KB | Output is correct |