제출 #235911

#제출 시각아이디문제언어결과실행 시간메모리
235911Bilyana게임 (IOI14_game)C++17
15 / 100
9 ms896 KiB
#include <bits/stdc++.h> using namespace std; vector<bool> used; vector<set<int>> cons; vector<vector<int>> con; void initialize(int n) { cons.resize(n); con.resize(n); used.resize(n, 0); for (int i=0; i<n; i++) { con[i].resize(n, 0); con[i][i] = 1; for (int j=0; j<n; j++) { if (i != j) { cons[i].insert(j); } } } } void removeEdge(int u, int v, int val) { con[u][v] = val; con[v][u] = val; cons[u].erase(v); cons[v].erase(u); } bool update(int u) { if (cons[u].size() == 1) { int v = *cons[u].begin(); removeEdge(u, v, 2); update(v); return 1; } return 0; } int hasEdge(int u, int v) { if (con[u][v] == 1) { return 0; } if (con[u][v] == 2) { return 1; } if (update(u) || update(v)) { return 1; } else { removeEdge(u, v, 1); update(u); update(v); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...