제출 #920658

#제출 시각아이디문제언어결과실행 시간메모리
920658Macker게임 (IOI14_game)C++17
42 / 100
1066 ms13144 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(v) v.begin(), v.end() vector<set<int>> adj; set<int> active; int n; bool dfs(int a, int f){ bool ret = 0; //if(adj[a].size() < active.size()){ for (auto &b : adj[a]) { if(active.find(b) != active.end()){ active.erase(b); if(b == f) return 1; if(dfs(b, f)) return 1; } } /* } else{ set<int> tmp = active; for (auto &b : tmp) { if(adj[a].find(b) != adj[a].end()){ active.erase(b); if(b == f) return 1; if(dfs(b, f)) return 1; } } } */ return 0; } void initialize(int N) { n = N; adj.resize(n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if(j != i) adj[i].insert(j); } } } int hasEdge(int u, int v) { for (int i = 0; i < n; i++) { active.insert(i); } adj[u].erase(v); adj[v].erase(u); if(dfs(u, v)) return 0; else { adj[u].insert(v); adj[v].insert(u); return 1; } }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'bool dfs(int, int)':
game.cpp:13:10: warning: unused variable 'ret' [-Wunused-variable]
   13 |     bool ret = 0;
      |          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...