Submission #1067518

#TimeUsernameProblemLanguageResultExecution timeMemory
1067518jsannemoCarnival (CEOI14_carnival)C++14
0 / 100
6 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) { if (sz(q) == 1) return 1; 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 col(N); col[0] = 1; vi distinct; distinct.push_back(0); rep(i,1,N) { set<int> cand(all(distinct)); cerr << i << endl; int bits = i ? (32 - __builtin_clz(i)) : 0; rep(b,0,bits) { vi q; rep(j,0,i) { if (j & (1 << b)) q.push_back(j); } set<int> expected; for (int w : q) expected.insert(col[w]); q.push_back(i); int res = query(q); if (res > sz(expected)) { for (int w : q) { if (cand.count(w)) { cand.erase(w); } } } } if (query({i, 0}) == 2) { if (cand.count(0)) cand.erase(0); } if (cand.empty()) { distinct.push_back(i); col[i] = sz(distinct); } else { assert(sz(cand) == 1); col[i] = col[*cand.begin()]; } } 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...