# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
750436 | vjudge1 | Carnival (CEOI14_carnival) | C++17 | 8 ms | 208 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<bits/stdc++.h>
using namespace std;
int n, a[10005];
bool vst[10005];
vector<int> last;
int ask(int i){
cout << '?' << " " << i << endl;
int pos;
cin >> pos;
return pos;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n;
int cnt = 1;
a[1] = 1;
last.push_back(1);
for(int i = 2 ; i <= n ; i++){
cout << i << " " << 1;
for(int j = 2 ; j <= i ; j++){
cout << " " << j;
}
cout << endl;
int num;
cin >> num;
a[i] = num;
if(num > cnt){
cnt++;
last.push_back(i);
}
else{
for(int j = 0 ; j < last.size() ; j++){
int v = last[j];
cout << "2 " << v << " " << i << endl;
cin >> num;
if(num == 1){
last[j] = i;
a[i] = j + 1;
break;
}
}
}
}
for(int i = 1 ; i <= n ; i++)
cout << a[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... |