Submission #995953

#TimeUsernameProblemLanguageResultExecution timeMemory
995953vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
6 ms600 KiB
#include <bits/stdc++.h> #define int long long #define fi first #define se second #define pb push_back using namespace std; //DONT LET SOMEONE CHEP YOUR CODE signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; vector<vector<int>> subsets; subsets.push_back({1}); subsets.push_back({1}); vector<int> query(n+1, 1); for (int i = 2; i <= n; i++){ cout << i << ' '; for (int j = 1; j <= i; j++){ cout << j << ' '; } cout << endl; cin >> query[i]; if (query[i] > query[i-1]){ subsets.push_back({i}); } else{ int l = 1, r = subsets.size()-1, ans = 0; while (l <= r) { int mid = (l + r)/2, q; vector<int> ask; for (int j = l; j <= mid; j++){ for (int z: subsets[j]){ ask.push_back(z); } } ask.push_back(i); cout << ask.size() << ' '; for (int z: ask){ cout << z << ' '; } cout << endl; cin >> q; if (q == mid - l + 2){ l = mid + 1; } else{ ans = mid; r = mid - 1; } } subsets[ans].push_back(i); } } vector<int> ansf(n+1, 0); int counter = 1; for (auto i: subsets){ for (auto j: i){ ansf[j] = counter; } counter++; } cout << 0 << ' '; for (int i = 1; i <= n; i++){ cout << ansf[i]-1 << ' '; } 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...