# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
587122 | ygim | Carnival (CEOI14_carnival) | C++17 | 7 ms | 320 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.
// P1_Carnival.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <math.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vp;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vp groups;
vi costumes(n, -1);
int c = 1;
groups.push_back({ 0, 1 });
costumes[0] = 1;
for (int i = 1; i < n; i++)
{
cout << groups.size() + 1 << " ";
for (pii p : groups) cout << p.first + 1 << " ";
cout << i + 1 << endl;
int t; cin >> t;
if (t == groups.size())
{
int l = 0, r = groups.size() - 1, mid = (l+r)/2;
while (l < r)
{
mid = (l + r) / 2;
cout << mid - l + 2 << " ";
for (int j = l; j <= mid; j++) cout << groups[j].first + 1 << " ";
cout << i + 1 << endl;
int t; cin >> t;
if (t == mid - l + 2) l = mid + 1;
else r = mid;
}
costumes[i] = groups[l].second;
}
else
{
groups.push_back({ i, ++c });
costumes[i] = c;
}
}
cout << 0 << " ";
for (int i : costumes) cout << 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... |