제출 #1051266

#제출 시각아이디문제언어결과실행 시간메모리
1051266TAhmed33게임 (IOI14_game)C++98
42 / 100
1084 ms12932 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int n; set <int> dd[1502]; void initialize (int N) { n = N; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i != j) { dd[i].insert(j); } } } } bool vis2[1502]; void dfs2 (int pos, int u, int v) { vis2[pos] = 1; for (auto j : dd[pos]) { if (!vis2[j] && !((j == v && pos == u) || (j == u && pos == v))) { dfs2(j, u, v); } } } int hasEdge (int u, int v) { for (int i = 0; i < n; i++) { vis2[i] = 0; } int cnt = 0; for (int i = 0; i < n; i++) { if (!vis2[i]) { dfs2(i, u, v); cnt++; } } if (cnt >= 2) { return 1; } else { dd[u].erase(v); dd[v].erase(u); return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...