제출 #1096089

#제출 시각아이디문제언어결과실행 시간메모리
1096089HaciyevAlik게임 (IOI14_game)C++14
42 / 100
1036 ms12904 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; const int mx = 1501; set<int> s[mx]; bool used[mx]; int n; void dfs(int u) { used[u] = 1; for(int v : s[u]) { if(!used[v]) { dfs(v); } } } void initialize(int N) { n = N; for(int i = 1; i <= n; ++i) { for(int j = 1; j <= n; ++j) { if(i == j) continue; s[i].insert(j); } } } int hasEdge(int u, int v) { ++u, ++v; for(int i = 1; i <= n; ++i) { used[i] = false; } s[u].erase(v); s[v].erase(u); dfs(1); int cnt = 0; for(int i = 1; i <= n; ++i) { cnt += used[i]; } if(cnt == n) { return 0; } else { s[u].insert(v); s[v].insert(u); return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...