Submission #1067507

#TimeUsernameProblemLanguageResultExecution timeMemory
1067507jsannemoCarnival (CEOI14_carnival)C++14
100 / 100
7 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; int query(vi q) { cout << q.size(); for (int i : q) cout << " " << i + 1; cout << endl; int res; cin >> res; return res; } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int N; cin >> N; vi distinct; vi col(N); col[0] = 1; distinct.emplace_back(0); rep(i,1,N) { vi cand = distinct; while (sz(cand) > 1) { int mid = sz(cand) / 2; vi half(cand.begin()+mid, cand.end()); vi q = half; q.push_back(i); if (query(q) < sz(q)) { cand = half; } else { cand.resize(mid); } } if (query({i, cand[0]}) == 1) col[i] = col[cand[0]]; else { distinct.push_back(i); col[i] = sz(distinct); } } cout << 0; rep(i,0,N) cout << " " << col[i]; cout << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...