# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333979 | updown1 | Carnival (CEOI14_carnival) | C++17 | 9 ms | 364 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 <map>
using namespace std;
int main(){
int n;
cin >> n;
int costume[n+1];
map<int,int> matched;
int counter = 0;
for(int i=1; i<=n; i++)
{
cout << matched.size()+1;
for(int j=1; j<=matched.size(); j++)
{
cout << " " << matched[j];
}
cout << " " << i << endl;
int newcount;
cin >> newcount;
if(newcount>counter)
{
matched[newcount] = i;
costume[i] = newcount;
counter++;
continue;
}
int a = 1;
int b = matched.size();
while(a!=b)
{
int mid = (a+b)/2;
cout << mid-a+2;
for(int j=a; j<=mid; j++)
{
cout << " " << matched[j];
}
cout << " " << i << endl;
int newval;
cin >> newval;
if(newval==(mid-a+1))
b = mid;
else
a = mid+1;
}
costume[i] = a;
}
cout << 0;
for(int i=1; i<=n; i++)
{
cout << " " << costume[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... |