제출 #315502

#제출 시각아이디문제언어결과실행 시간메모리
315502qpwoeirut게임 (IOI14_game)C++17
15 / 100
1 ms512 KiB
#include "game.h" const int MN = 1501; int N; int mat[MN][MN]; int ct[MN]; int alone[MN]; int edges, q; void initialize(int n) { N = n; edges = N-1; q = (N * (N-1)) / 2; for (int i=0; i<N; ++i) { for (int j=0; j<N; ++j) { mat[i][j] = -1; } ct[i] = 0; mat[i][i] = 1; alone[i] = true; } } int hasEdge(int u, int v) { if (mat[u][v] != -1) return mat[u][v]; ++ct[u]; ++ct[v]; --q; mat[u][v] = (ct[u] == N-1) || (ct[v] == N-1); if (alone[u] && alone[v]) { } if (q < edges) mat[u][v] = true; if (mat[u][v]) { --edges; alone[u] = alone[v] = false; } mat[v][u] = mat[u][v]; return mat[u][v]; } /* 4 2 3 1 3 0 2 0 1 1 2 0 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...