제출 #800555

#제출 시각아이디문제언어결과실행 시간메모리
800555BERNARB01게임 (IOI14_game)C++17
0 / 100
7 ms15956 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 { if (deg[v] == n || deg[u] == n) { g[u][v] = g[v][u] = 1; } } } return g[u][v]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...