# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971232 | makanhulia | Carnival (CEOI14_carnival) | C++17 | 1 ms | 692 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>
#define pb push_back
using namespace std;
int main(){
int n; cin >> n;
vector<int> sim;
vector<int> belum;
int warna[155];
for(int i = 1; i <= n; i++){
cout << sim.size() + 1;
for(int j = 0; j < sim.size(); j++){
cout << " " << sim[j];
}
cout << " " << i;
cout << endl;
int jawab; cin >> jawab;
if(jawab == sim.size() + 1){
sim.pb(i);
}else{
belum.pb(i);
}
}
for(int i = 0; i < sim.size(); i++){
warna[sim[i]] = i + 1;
}
for(int i = 0; i < belum.size(); i++){
int now = belum[i];
int l = 0, r = sim.size();
int ans = -1;
while(l <= r){
int mid = (l + r)/2;
cout << mid + 1;
cout << " " << now;
for(int j = 0; j <= mid; j++){
cout << " " << sim[j];
}
cout << endl;
int idx = mid + 1;
int jawab; cin >> jawab;
if(jawab == idx){
ans = mid;
r = mid - 1;
}else{
l = mid + 1;
}
}
warna[now] = ans + 1;
}
cout << "0";
for(int i = 1; i <= n; i++){
cout << " " << warna[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... |