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 "game.h"
#include <bits/stdc++.h>
using namespace std ;
const int N = 1502 ;
int degree[N] ;
set <int> pr[N] ;
void initialize(int n) {
for ( int i = 0 ; i < n ; ++i ) degree[i] = n-1 ;
for ( int i = 0 ; i < n ; ++i ) {
for ( int j = 0 ; j < n ; ++j )
if ( j!=i ) pr[i].insert ( j );
}
}
int hasEdge(int u, int v) {
int ans = 0 ;
if ( min(degree[u], degree[v]) <= 1 ) ans = 1;
degree[u]-- ; degree[v]-- ;
pr[u].erase ( v ) ;
pr[v].erase ( u ) ;
if ( degree[u] == 1 ) degree[*pr[u].begin()]-- ;
if ( degree[v] == 1 ) degree[*pr[v].begin()]-- ;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |