제출 #197621

#제출 시각아이디문제언어결과실행 시간메모리
197621joylintp게임 (IOI14_game)C++17
42 / 100
1048 ms12792 KiB
#include"game.h" #include<bits/stdc++.h> using namespace std; bool vis[1500]; int n; set<int> edge[1500]; void dfs(int k) { vis[k] = true; for (int i : edge[k]) if (!vis[i]) dfs(i); } void initialize(int N) { n = N; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) edge[i].insert(j), edge[j].insert(i); } int hasEdge(int u, int v) { edge[u].erase(v), edge[v].erase(u); for (int i = 0; i < n; i++) vis[i] = false; dfs(0); bool con = true; for (int i = 0; con && i < n; i++) con = vis[i]; if (!con) edge[u].insert(v), edge[v].insert(u); return !con; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...