Submission #364768

#TimeUsernameProblemLanguageResultExecution timeMemory
364768ijxjdjdCarnival (CEOI14_carnival)C++14
0 / 100
7 ms364 KiB
#include <bits/stdc++.h> #define FR(i, N) for (int i = 0; i < int(N); i++) #define all(x) begin(x), end(x) using namespace std; using ll = long long; int query(vector<int> q) { cout << q.size() << " "; for (int a : q) { cout << a << " "; } cout << endl; int x; cin >> x; return x; } vector<int> merge(vector<vector<int>>& groups, int i) { vector<int> res; FR(j, i) { res.insert(res.end(), all(groups[j])); } return res; } int main() { cin.tie(0); cin.sync_with_stdio(0); int N; cin >> N; vector<vector<int>> groups; groups.emplace_back(); groups[0].push_back(1); vector<int> tot; tot.push_back(1); int ans[N]; ans[0] = 1; for (int i = 2; i <= N; i++) { tot.push_back(i); if (query(tot) == groups.size() + 1) { groups.emplace_back(); groups[groups.size()-1].push_back(i); ans[i-1] = groups.size(); } else { int low = 0; int high = groups.size()-1; while (low < high) { int mid = (low + high)/2; if (query(merge(groups, mid+1)) == mid+1) { high = mid; } else { low = mid+1; } } ans[i-1] = high+1; groups[high].push_back(i); } } cout << 0 << " "; FR(i,N) { cout << ans[i] << " "; } return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:40:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if (query(tot) == groups.size() + 1) {
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
#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...