Submission #1253111

#TimeUsernameProblemLanguageResultExecution timeMemory
1253111al95ireyizEaster Eggs (info1cup17_eastereggs)C++20
0 / 100
1 ms520 KiB
//*** Bismillah ***// #pragma GCC optimize("O3", "fast-math", "unroll-loops", "no-stack-protector") #include <bits/stdc++.h> using namespace std; #if !defined(ONLINE_JUDGE) and !defined(EVAL) #include "template/debug.h" #else #define d(x...) #endif #define fr first #define er erase #define sc second #define in insert #define ll long long #define pb push_back #define vll vector<ll> #define pll pair<ll,ll> #define ull unsigned ll #define vpll vector<pll> #define len(x) (ll) x.size() #define all(x) x.begin(),x.end() const ll INF = 1e9; const ll INFL = 1e18; const ll MOD = 1e9+7; // const ll MOD = 998244353; const ll maxn = 600+5; ll n,m,k=0; #include "grader.h" ll cv, mxd, dp[maxn], par[maxn]; vll g[maxn]; vector<int> ch[maxn]; void prep(ll u, ll p = -1, ll dep = 1){ dp[u] = dep; par[u] = p; mxd = max(mxd, dep); ch[u].pb(u); for(auto v : g[u]){ if(v == p) continue; prep(v, u, dep + 1); for(auto x : ch[v]) ch[u].pb(x); } } vector<int> st; void sapsup(ll u, ll p = -1){ if(len(g[u]) == 1){ st.pb(u); return; } st.pb(u); for(auto v : g[u]){ if(v == p) continue; sapsup(v, u); } st.pb(u); } int findEgg(int _n, vector<pair<int, int>>_g){ n = _n; for(ll i = 1; i <= n; i ++){ g[i].clear(), ch[i].clear(); } ll mx = 0; for(auto [x, y] : _g){ g[x].pb(y); g[y].pb(x); } sapsup(1); d(st); ll l = 0, r = len(st) - 1; while(l <= r){ ll md = (l + r) >> 1; vector<int> qr; for(ll i = 0; i <= md; i ++){ qr.pb(st[i]); } if(query(qr)){ r = md - 1; cv = qr[md]; } else{ l = md + 1; } } return cv; } // void _(ll &tt){ // } // signed main() { // ll tm = clock(); // cin.tie(0)->sync_with_stdio(0); // ll t = 1; // cin >> t; // for(ll tt = 1; tt <= t; tt ++) { // _(tt); // } // cerr << "\n\033[1;31mTime: \033[1;30m" \ // << (double)(clock()-tm)/1000000 << "\033[1;32m seconds\n"; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...