Submission #246920

#TimeUsernameProblemLanguageResultExecution timeMemory
246920oscarsierra12Game (IOI14_game)C++14
0 / 100
5 ms384 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...