Submission #909991

#TimeUsernameProblemLanguageResultExecution timeMemory
909991nasir_bashirovEaster Eggs (info1cup17_eastereggs)C++11
87 / 100
12 ms1348 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define db long double #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> #define endl '\n' #define all(x) x.begin(), x.end() #define fastio\ ios_base::sync_with_stdio(0);\ cin.tie(0);\ cout.tie(0)\ vi g[550], v; int n; void dfs(int node, int par){ v.push_back(node); for(int i : g[node]){ if(i == par) continue; dfs(i, node); } } int findEgg(int N, vii bridges){ n = N; for(int i = 1; i <= n; i++){ g[i].clear(); } for(pii i : bridges){ g[i.first].push_back(i.second); g[i.second].push_back(i.first); } dfs(1, 1); int l = 0, r = n - 1, res = 0; while(l <= r){ int mid = (l + r) / 2; vi vv; for(int i = 0; i <= mid; i++) vv.push_back(v[i]); if(query(vv)){ res = mid; r = mid - 1; } else{ l = mid + 1; } } return v[res]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...