제출 #1155953

#제출 시각아이디문제언어결과실행 시간메모리
1155953itaykarnyEaster Eggs (info1cup17_eastereggs)C++20
0 / 100
0 ms424 KiB
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> #include<queue> #include<string> #include<math.h> using namespace std; using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using pll = pair<ll, ll>; using vpll = vector<pair<ll, ll>>; using vvpll = vector<vpll>; /* int query(vector<int> t) { for (auto i : t) { if (i == 2) { return 1; } } return 0; }*/ int query(vector < int > islands); vector<vector<int>> g; vector<int> nodes; vector<bool> vis; bool done_with_half = false; int n; void dfs(int node, int half_nodes, vector<int>& maybe_nodes, vector<bool>& visited_nodes) { maybe_nodes.push_back(node); vis[node] = true; visited_nodes[node] = false; if (int(maybe_nodes.size()) == half_nodes) { int answer = query(maybe_nodes); if (answer == 0) { maybe_nodes.clear(); for (int i : nodes) { if (visited_nodes[i]) { visited_nodes[i] = false; maybe_nodes.push_back(i); } else { visited_nodes[i] = true; } } } done_with_half = true; return; } for (auto i : g[node]) { if (done_with_half) { return; } if (!vis[i]) { dfs(i, half_nodes, maybe_nodes, visited_nodes); } } } int findEgg(int N, vector < pair < int, int > > bridges) { /*n = N; g.resize(n); for (int i = 0; i < n - 1; i++) { bridges[i].first--, bridges[i].second--; g[bridges[i].first].push_back(bridges[i].second); g[bridges[i].second].push_back(bridges[i].first); } vis.resize(n, false); for (int i = 0; i < n; i++) { nodes.push_back(i); } while (nodes.size() > 1) { done_with_half = false; vector<int> next_nodes; vector<bool> visited_nodes(n, true); dfs(nodes[0], (int(nodes.size())) / 2, next_nodes, visited_nodes); nodes = next_nodes; vis = visited_nodes; } return nodes[0] + 1;*/ return 1; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int s; cin >> s; vector<pair<int, int>> bridges(s-1); for (ll i = 0; i < s- 1; i++) { cin >> bridges[i].first >> bridges[i].second; } cout << findEgg(s, bridges); }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...