# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784158 | jnjwnwnw | Carnival (CEOI14_carnival) | C++11 | 22 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |