제출 #1165818

#제출 시각아이디문제언어결과실행 시간메모리
1165818SmuggingSpunCarnival (CEOI14_carnival)C++20
100 / 100
4 ms440 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<vector<int>>a; a.emplace_back(vector<int>(1, 1)); for(int i = 2; i <= n; i++){ int low = 0, high = int(a.size()) - 1, p = -1; while(low <= high){ int mid = (low + high) >> 1; cout << mid + 2 << " " << i << " "; for(int j = 0; j <= mid; j++){ cout << a[j][0] << " "; } cout << endl; int x; cin >> x; if(x == mid + 2){ low = mid + 1; } else{ high = (p = mid) - 1; } } if(p == -1){ a.emplace_back(vector<int>(1, i)); } else{ a[p].emplace_back(i); } } vector<int>ans(n + 1); for(int i = 0; i < a.size(); i++){ for(int& j : a[i]){ ans[j] = i + 1; } } cout << "0 "; for(int i = 1; i <= n; i++){ cout << ans[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...