#include <bits/stdc++.h>
using namespace std;
#define ll long long
int coun(int l, int r, int ar[]){
set<int> s;
for (int i = l; i <= r; i++){
s.insert(ar[i]);
}
return s.size();
}
string getstr(int l, int r){
string ans = "";
for (int i = l; i <= r; i++){
ans += to_string(i) + " ";
}
return ans;
}
int main()
{
int n, res, col = 2;
cin>>n;
int ar[n];
ar[0] = 1;
for (int i = 1; i < n; i++){
cout<<getstr(1, i + 1)<<endl;
cin>>res;
int c = coun(0, i - 1, ar);
if (res > c){
ar[i] = col;
col++;
continue;
}
int l = 0, r = i - 1;
while (true){
int mid = (l + r) / 2;
string s = getstr(l + 1, mid + 1) + to_string(i + 1);
cout<<s<<endl;
cin>>res;
c = coun(l, mid, ar);
if (c == res){
if (c == 1){
ar[i] = ar[l];
break;
}
else{
r = mid;
}
}
else{
l = mid + 1;
}
}
}
cout<<"0 ";
for (int i = 0; i < n; i++){
cout<<ar[i]<<' ';
}
cout<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |