Submission #284934

#TimeUsernameProblemLanguageResultExecution timeMemory
284934triplem5dsGame (IOI14_game)C++14
42 / 100
1084 ms1400 KiB
#include "game.h" #include "bits/stdc++.h" using namespace std; bool cnc[1505][1505]; int N; void initialize(int n) { N = n; for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) cnc[i][j] = cnc[j][i] = 1; } int vis[1505], cnt; int dfs(int node){ if(vis[node] == cnt)return 0; vis[node] = cnt; int ans = 1; for(int j = 0; j < N; j++) if(cnc[node][j] && vis[j] != cnt) { ans += dfs(j); } return ans; } int hasEdge(int u, int v) { cnc[u][v] = cnc[v][u] = 0; cnt++; if(dfs(0) != N){ cnc[u][v] = cnc[v][u] = 1; return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...