This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Alicelib.h"
#include<bits/stdc++.h>
using namespace std;
void Alice(int N, int M, int A[], int B[])
{
vector<pair<int,int>> edges;
for(int i=0;i<M;i++)
edges.push_back({A[i],B[i]});
for(int i=0;i<N;i++)
{
for(int b=0;b<10;b++)
{
if((i&(1<<b)))
{
edges.push_back({i,N+b});
}
}
}
for(int i=0;i<N+10;i++)
edges.push_back({N+10,i});
for(int i=0;i<10;i++)
edges.push_back({N+11,N+i});
InitG(N+12, edges.size());
for(int i=0;i<edges.size();i++)
MakeG(i,edges[i].first,edges[i].second);
}
#include "Boblib.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> con[1100];
map<pair<int,int>,int> mp;
map<pair<int,int>,int> init;
int p,q;
int sum[1100];
void Bob(int V, int U, int C[], int D[])
{
for(int i=0;i<U;i++)
{
con[C[i]].push_back(D[i]);
con[D[i]].push_back(C[i]);
mp[{C[i],D[i]}]++;
mp[{D[i],C[i]}]++;
}
for(int i=0;i<V;i++)
{
if((int)con[i].size() == V-2)
{
p=i;
for(int j=0;j<V;j++)
if(j!=i && mp[{i,j}]==0)
q=j;
break;
}
}
vector<pair<int,int>> b;
for(auto x:con[q])
b.push_back({-(int)con[x].size(),x});
sort(b.begin(),b.end());
for(int i=0;i<10;i++)
for(auto x:con[b[i].second])
sum[x] += (1<<i);
vector<pair<int,int>> rez;
for(int i=0;i<V;i++)
{
if(i!=p && i!=q && !mp[{q,i}])
{
//cout<<i<<" "<<sum[i]<<" sum\n";
for(auto x:con[i])
{
if(x!=p && x!=q && !mp[{q,x}] && init[{sum[x],sum[i]}]==0)
{
init[{sum[i],sum[x]}]++;
rez.push_back({sum[i],sum[x]});
}
}
}
}
InitMap(V-12,rez.size());
for(auto e:rez)
MakeMap(e.first,e.second);
}
Compilation message (stderr)
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for(int i=0;i<edges.size();i++)
| ~^~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |