# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
702856 | kxd | Carnival (CEOI14_carnival) | C++17 | 10 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 <bits/stdc++.h>
#define int long long
#define ll long long
#define pb push_back
#define p_q priority_queue
#define m_p make_pair
#define pii pair<int,int>
#define endl '\n'
#define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(),x.end()
#define ft first
#define sd second
using namespace std;
const int N = 1e5+5;
const int INF = 1e18;
const int MOD = 1e9+7;
int c[N];
vector<int> v;
bool bl[N];
signed main() {
//INIT
int n;
cin >> n;
v.pb(1);
c[1] = 1;
int t;
for (int i = 2; i <= n; i++) {
cout << v.size()+1 << ' ';
for (auto x: v) {
cout << x << ' ';
}
cout << i << endl;
cin >> t;
if (t > v.size()) {
bl[i] = 1;
v.pb(i);
c[i] = v.size();
}
}
int ans = -1;
for (int i = 2; i <= n; i++) {
if (bl[i]) continue;
int lo = 0, hi = v.size()-1;
while (lo <= hi) {
int mid = (lo+hi)/2;
cout << mid+2 << ' ';
for (int i = 0; i <= mid; i++) {
cout << v[i] << ' ';
}
cout << i << endl;
cin >> t;
if (t == mid + 2) lo = mid + 1;
else {
ans = mid;
hi = mid - 1;
}
}
c[i] = c[v[ans]];
}
cout << 0 << ' ';
for (int i = 1; i <= n; i++) {
cout << c[i] << ' ';
}
}
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... |