#include <set>
#include <vector>
#include "icc.h"
using namespace std;
int const N=110;
vector<int>chi[N]={};
int par[N]={};
set<int>roots;
bool check(vector<int>a,vector<int>b)
{
int* c=new int[a.size()];int *d=new int[b.size()];
for (int i=0;i<a.size();i++)
c[i]=a[i];
for (int i=0;i<b.size();i++)
d[i]=b[i];
int z=query(a.size(),b.size(),c,d);
return z;
}
void cq(int l,int r)
{
set<int>a,b;
for (auto i:chi[l])
a.insert(i);
for (auto i:chi[r])
b.insert(i);
int x=*(begin(a));
while (a.size())
{
x=*begin(a);
a.erase(x);
if (check({begin(a),end(a)},{begin(b),end(b)})==0)
break;
}
int y=*begin(b);
while (b.size())
{
y=*begin(b);
b.erase(y);
if (check({x},{begin(b),end(b)})==0)
break;
}
setRoad(x,y);
}
void naive()
{
for (auto i:roots)
{
for (auto j:roots)
{
if (j<=i)
continue;
if (check(chi[i],chi[j]))
{
cq(i,j);
}
}
}
}
void run(int n)
{
for (int i=1;i<=n;i++)
{
roots.insert(i);
par[i]=i;
chi[i].push_back(i);
}
for (int i=0;i<n-1;i++)
{
naive();
}
}
Compilation message
icc.cpp: In function 'bool check(std::vector<int>, std::vector<int>)':
icc.cpp:12:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
12 | for (int i=0;i<a.size();i++)
| ~^~~~~~~~~
icc.cpp:14:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
14 | for (int i=0;i<b.size();i++)
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
600 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
116 ms |
660 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
244 ms |
1104 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
193 ms |
848 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
172 ms |
604 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
160 ms |
600 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |