제출 #235897

#제출 시각아이디문제언어결과실행 시간메모리
235897Bilyana게임 (IOI14_game)C++17
42 / 100
1055 ms2584 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") #pragma GCC optimize ("unroll-loops") #pragma GCC target ("avx2") using namespace std; vector<bool> used; vector<vector<int>> con; void initialize(int n) { con.resize(n); used.resize(n, 0); for (int i=0; i<n; i++) { for (int j=0; j<n; j++) { if (j == i) { continue; } con[i].push_back(j); } } } bool dfs(int curr, int par, int en) { if (curr == en) { return 1; } used[curr] = 1; for (auto to : con[curr]) { if (to != par && !used[to]) { if (dfs(to, curr, en)) { return 1; } } } return 0; } void removeEdge(int u, int v) { for (int i=0; i<(int)con[u].size(); i++) { if (con[u][i] == v) { swap(con[u][i], con[u].back()); con[u].pop_back(); } } } int hasEdge(int u, int v) { fill(used.begin(), used.end(), 0); if (dfs(u, v, v)) { removeEdge(u, v); removeEdge(v, u); return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...