#include <bits/stdc++.h>
#include "game.h"
using namespace std;
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define pdd pair<double,double>
#define mp make_pair
#define AmirMakaM ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
// solve it
const ull SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937_64 mrand(SEED);
ull rnd(ull x = ~(0ull)) {return mrand() % x;}
const ll MOD = 998244353;
const ll INF = 1e16+20;
const int inf = 1e9 + 7;
const ll N = 3e5+1;
const ll M = 2e3+1;
const double pi = 2*acos(0.0);
const int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};
int n;
vector<pair<int,set<int>>> t;
void initialize(int N) {
n = N;
for(int i=0; i<n; i++) {
set<int> cur;
for(int j=0; j<n; j++) {
if(i != j) cur.insert(j);
}
t.pb({i,cur});
}
}
int hasEdge(int a, int b) {
if(sz(t[a].s) > sz(t[b].s)) swap(a,b);
if(sz(t[a].s) > 2 && sz(t[b].s) > 2) {
t[a].s.erase(b), t[b].s.erase(a);
return 0;
} else if(sz(t[a].s) > 1 && sz(t[b].s) > 2) {
t[a].s.erase(b), t[b].s.erase(a);
return 0;
} else if(sz(t[a].s) > 1 && sz(t[b].s) > 1) {
int cnt = 0;
for(int i=0; i<n; i++) {
if(sz(t[i].s) == 1) cnt++;
}
t[a].s.erase(b), t[b].s.erase(a);
return (cnt>1);
} else if(sz(t[a].s) > 0 && sz(t[b].s) > 1) {
t[a].s.erase(b), t[b].s.erase(a);
return 1;
} else if(sz(t[a].s) > 0 && sz(t[b].s) > 0) {
int cnt = 0;
for(int i=0; i<n; i++) {
if(sz(t[i].s)) cnt++;
}
return (cnt!=2);
}
}
Compilation message (stderr)
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
70 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |