#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 150 + 20;
int c[maxn] , id = 1;
int cnt(int l , int r)
{
vector<int> tmp;
for(int i = l; i < r; i++)
tmp.pb(c[i]);
sort(tmp.begin() , tmp.end());
return unique(tmp.begin() , tmp.end()) - tmp.begin();
}
int ask(int l , int r)
{
cout << r - l + 1 << " ";
for(int i = l; i <= r; i++)
cout << i + 1 << " ";
cout << endl;
int x;
cin >> x;
return x;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for(int i = 1; i < n; i++)
{
int L = 0 , R = i;
if(ask(0 , i) != cnt(0 , i))
{
c[i] = id++;
continue;
}
while(R - L > 1)
{
int m = (L + R) / 2;
if(ask(m , i) != cnt(m , i))
R = m;
else
L = m;
}
c[i] = c[L];
}
cout << 0 << " ";
for(int i = 0; i < n; i++)
cout << c[i] + 1 << " ";
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
256 KB |
Output is correct |
2 |
Correct |
10 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
420 KB |
Output is correct |
4 |
Correct |
7 ms |
504 KB |
Output is correct |
5 |
Correct |
16 ms |
256 KB |
Output is correct |
6 |
Correct |
12 ms |
256 KB |
Output is correct |
7 |
Correct |
12 ms |
424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
420 KB |
Output is correct |
2 |
Correct |
16 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
276 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
384 KB |
Output is correct |
6 |
Correct |
10 ms |
256 KB |
Output is correct |
7 |
Correct |
14 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
256 KB |
Output is correct |
2 |
Correct |
14 ms |
256 KB |
Output is correct |
3 |
Correct |
15 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
396 KB |
Output is correct |
5 |
Correct |
11 ms |
256 KB |
Output is correct |
6 |
Correct |
7 ms |
344 KB |
Output is correct |
7 |
Correct |
10 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
344 KB |
Output is correct |
3 |
Correct |
10 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
12 ms |
256 KB |
Output is correct |
6 |
Correct |
10 ms |
284 KB |
Output is correct |
7 |
Correct |
13 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
256 KB |
Output is correct |
2 |
Correct |
20 ms |
384 KB |
Output is correct |
3 |
Correct |
13 ms |
256 KB |
Output is correct |
4 |
Correct |
8 ms |
336 KB |
Output is correct |
5 |
Correct |
9 ms |
340 KB |
Output is correct |
6 |
Correct |
8 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |