이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int ask(vector<int> &v) {
int x;
cout << v.size() << ' ';
for (int i: v) cout << i << ' ';
cout << endl;
cin >> x;
return x;
}
int col[155], C[100000];
vector<int> v;
void solve() {
int n;
cin >> n;
set<int> s;
for (int i = 1; i <= n; i++) col[i] = i;
for (int i = 1; i <= n; i++) {
v.clear();
int l = i, r = n, mid, pos = 1e9;
while(l <= r) {
v.clear();
mid = (l + r) / 2;
for (int j = i; j <= mid; j++) {
v.push_back(j);
}
int ans = ask(v);
if(ans < mid - i + 1) {
if(ans == mid - i) pos = min(pos, mid);
r = mid - 1;
}
else l = mid + 1;
}
if(pos != 1e9) col[pos] = col[i];
//cout << "DM " << i << ' ' << pos << '\n';
}
cout << 0 << ' ';
for (int i = 1; i <= n; i++) s.insert(col[i]);
int cnt = 0;
for (int i: s) C[i] = ++cnt;
for (int i = 1; i <= n; i++) cout << C[col[i]] << ' ';
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |