#include <bits/stdc++.h>
#define N 200
#define MAX_SQRT 20
using namespace std;
int cor[N], n, raiz, used[N], pai[N], peso[N], comprimir[N], cnt;
vector< int > v [20];
int query(vector<int> v)
{
if(v.size() == 0) return 0;
cout<<v.size()<<" ";
for(auto x: v) cout<<x<<" ";
cout<<endl;
int k;
cin>>k;
return k;
}
int get(int ini, int fim)
{
if(fim < ini) swap(ini, fim);
vector<int> vv;
for(int i = ini; i <= fim; i++) vv.push_back(i);
return query(vv);
}
int main()
{
cin>>n;
raiz = ceil(sqrt(n));
//for(int i = 1; i <= n; i++) cin>>cor[i];
for(int i = 1; i <= n; i ++)
{
if(!pai[i]) pai[i] = ++cnt;
if( get(i, n) == get(i + 1, n))
{
int ini = i + 1, fim = n, mid, best = i;
while(fim >= ini)
{
mid = (ini + fim)/2;
if( get(i, mid) == get(i + 1, mid))
{
best = mid;
fim = mid - 1;
}
else ini = mid + 1;
}
pai[best] = pai[i];
}
}
cout<<"0 ";
for(int p = 1; p <= n; p++) cout<<pai[p]<<" ";
cout<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
248 KB |
Integer 138 violates the range [1, 137] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
308 KB |
Integer 146 violates the range [1, 145] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
384 KB |
Integer 134 violates the range [1, 133] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
384 KB |
Integer 144 violates the range [1, 143] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
420 KB |
Integer 150 violates the range [1, 149] |
2 |
Halted |
0 ms |
0 KB |
- |