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>
#include "game.h"
using namespace std;
using ll = long long;
const int mxN = 2e3+10;
int n;
set<int> adj[mxN];
int hasEdge(int a, int b) {
adj[a].erase(b);
adj[b].erase(a);
if(adj[a].size() == 0 || adj[b].size() == 0) return 1;
if(adj[a].size() == 1) {
int k = *(adj[a].begin());
if(adj[k].size() == 1) return 1;
}
if(adj[b].size() == 1) {
int k = *(adj[b].begin());
if(adj[k].size() == 1) return 1;
}
return 0;
}
void initialize(int N) {
n = N;
for(int i = 0; i < n; i++) {
for(int j = i+1; j < n; j++) {
adj[i].insert(j);
adj[j].insert(i);
}
}
}
/*
int main()
{
initialize(4);
cout<<hasEdge(0,1)<<hasEdge(3,0)<<hasEdge(1,2)<<hasEdge(0,2);
cout<<hasEdge(1,3)<<hasEdge(2,3);
return 0;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |