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 <bits/stdc++.h>
#define MAXN 1510
using namespace std;
set<int> G[MAXN],a,b;
int N;
void initialize(int n)
{
N=n;
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
{
if (i!=j)
G[i].insert(j);
}
}
}
void DFS(int i,pair<int,int> skipp,set<int> &s)
{
s.insert(i);
for (int next : G[i])
{
if ((i==skipp.first && next==skipp.second) || (i==skipp.second && next==skipp.first))
continue;
if (!s.count(next))
{
s.insert(next);
DFS(next,skipp,s);
}
}
}
bool Check(int u,int v)
{
a.clear();
b.clear();
DFS(u,{u,v},a);
DFS(v,{u,v},b);
return (a.size()!=N || b.size()!=N);
}
int hasEdge(int u, int v)
{
if (Check(u,v))
return 1;
G[u].erase(v);
G[v].erase(u);
return 0;
}
Compilation message (stderr)
game.cpp: In function 'bool Check(int, int)':
game.cpp:38:21: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
38 | return (a.size()!=N || b.size()!=N);
| ~~~~~~~~^~~
game.cpp:38:36: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
38 | return (a.size()!=N || b.size()!=N);
| ~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |