제출 #1131574

#제출 시각아이디문제언어결과실행 시간메모리
1131574alterio사육제 (CEOI14_carnival)C++20
100 / 100
3 ms424 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define all(x) (x).begin(), (x).end() const int mxn = 200; vector<int> known[mxn]; vector<int> guess(int l, int r) { vector<int> res; for (int i = l; i <= r; i++) { if (known[i].size()) res.push_back(known[i][0]); } return res; } void print(vector<int> v) { cout << v.size() << " "; for (auto x : v) cout << x << " "; cout << endl; } int main() { int n; cin >> n; int sz = 1; known[1] = {1}; for (int i = 2; i <= n; i++) { int l = 1, r = sz + 2; while (l + 1 < r) { int mid = (l + r) / 2; vector<int> v = guess(l, mid); v.push_back(i); print(v); int x; cin >> x; if (x == v.size()) l = mid; else r = mid; } if (l < sz) { print({known[l][0], i}); int x; cin >> x; if (x != 1) l = r; } known[l].push_back(i); sz = max(sz, l); } int ind[n + 10]; for (int i = 1; i <= sz; i++) { for (auto x : known[i]) ind[x] = i; } cout << 0 << " "; for (int i = 1; i <= n; i++) cout << ind[i] << " "; }
#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...