Submission #800556

#TimeUsernameProblemLanguageResultExecution timeMemory
800556BERNARB01Game (IOI14_game)C++17
0 / 100
8 ms16000 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; #ifdef B01 #include "../deb.h" #else #define deb(...) #endif const int N = 2003; int n; int cntGiven; int g[N][N]; int deg[N]; void initialize(int n_) { n = n_; memset(g, -1, sizeof g); memset(deg, 0, sizeof deg); cntGiven = 0; } int hasEdge(int u, int v) { if (g[u][v] == -1) { ++deg[u]; ++deg[v]; cntGiven += (deg[u] == n) + (deg[v] == n); if (cntGiven < n - 2) { if (deg[v] == n || deg[u] == n) { g[u][v] = g[v][u] = 1; } else if (deg[v] == n - 1 || deg[u] == n - 1) { g[u][v] = g[v][u] = 1; } else { g[u][v] = 0; } } else { if (deg[v] == n || deg[u] == n) { g[u][v] = g[v][u] = 1; } else { g[u][v] = 0; } } } return g[u][v]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...