#include "icc.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=105;
int A[N],B[N];
int Ask(vector<int> a, vector<int> b)
{
for(int i=0;i<a.size();i++) A[i]=a[i];
for(int i=0;i<b.size();i++) B[i]=b[i];
return query(a.size(),b.size(),A,B);
}
int p[N];
int Find(int x){ return p[x]==x?x:p[x]=Find(p[x]);}
void Union(int x, int y){ p[Find(x)]=Find(y);}
void init(){ for(int i=0;i<N;i++) p[i]=i;}
bool use[N];
vector<int> Reduce(vector<int> x, vector<int> y)
{
while(x.size()>1)
{
vector<int> v[2];
for(int i=0;i<x.size();i++) v[i&1].pb(x[i]);
if(Ask(v[0],y)) x=v[0];
else x=v[1];
}
return x;
}
void run(int n)
{
srand(time(0));
init();
for(int t=1;t<n;t++)
{
vector<int> root,v[2];
for(int i=1;i<=n;i++) if(Find(i)==i) root.pb(i);
while(1)
{
random_shuffle(root.begin(),root.end());
for(int i=0;i<root.size();i++) use[root[i]]=i&1;
v[0].clear();
v[1].clear();
for(int i=1;i<=n;i++) v[use[Find(i)]].pb(i);
if(Ask(v[0],v[1])) break;
}
v[0]=Reduce(v[0],v[1]);
v[1]=Reduce(v[1],v[0]);
setRoad(v[0][0],v[1][0]);
Union(v[0][0],v[1][0]);
}
}
Compilation message
icc.cpp: In function 'int Ask(std::vector<int>, std::vector<int>)':
icc.cpp:9:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<a.size();i++) A[i]=a[i];
~^~~~~~~~~
icc.cpp:10:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<b.size();i++) B[i]=b[i];
~^~~~~~~~~
icc.cpp: In function 'std::vector<int> Reduce(std::vector<int>, std::vector<int>)':
icc.cpp:23:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<x.size();i++) v[i&1].pb(x[i]);
~^~~~~~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:40:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<root.size();i++) use[root[i]]=i&1;
~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
504 KB |
Ok! 99 queries used. |
2 |
Correct |
9 ms |
504 KB |
Ok! 108 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
504 KB |
Ok! 530 queries used. |
2 |
Correct |
66 ms |
504 KB |
Ok! 841 queries used. |
3 |
Correct |
62 ms |
588 KB |
Ok! 800 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
156 ms |
632 KB |
Ok! 1471 queries used. |
2 |
Correct |
218 ms |
504 KB |
Ok! 2089 queries used. |
3 |
Correct |
158 ms |
504 KB |
Ok! 1583 queries used. |
4 |
Correct |
171 ms |
504 KB |
Ok! 1646 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
165 ms |
632 KB |
Ok! 1618 queries used. |
2 |
Correct |
169 ms |
504 KB |
Ok! 1647 queries used. |
3 |
Correct |
185 ms |
632 KB |
Ok! 1788 queries used. |
4 |
Correct |
155 ms |
560 KB |
Ok! 1547 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
191 ms |
556 KB |
Too many queries! 1849 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
194 ms |
504 KB |
Too many queries! 1867 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |