Submission #433222

#TimeUsernameProblemLanguageResultExecution timeMemory
433222hhhhauraEaster Eggs (info1cup17_eastereggs)C++14
100 / 100
21 ms356 KiB
#include "grader.h" #define wiwihorz #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma loop-opt(on) #define rep(i, a, b) for(int i = a; i <= b; i ++) #define rrep(i, a, b) for(int i = b; i >= a; i--) #define all(x) x.begin(), x.end() #define ceil(a, b) ((a + b - 1) / (b)) #define INF 1000000000000000000 #define MOD 1000000007 #define eps (1e-9) using namespace std; #define lld long double #define pii pair<int, int> #define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()) #ifdef wiwihorz #define print(a...) kout("[" + string(#a) + "] = ", a) void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;} void kout() { cerr << endl; } template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); } #else #define print(...) 0 #define vprint(...) 0 #endif int n, timestamp = 0; vector<vector<int>> mp; vector<int> qq, pre; void dfs(int x, int par) { pre[++timestamp] = x; for(auto i : mp[x]) if(i != par) { dfs(i, x); } } int findEgg (int N, vector<pii> bridges) { n = N, timestamp = 0; mp.assign(n + 1, vector<int>()); qq.clear(), pre.assign(n + 1, 0); for(auto i : bridges) { mp[i.first].push_back(i.second); mp[i.second].push_back(i.first); } dfs(1, 1); int l = 0, r = timestamp; while(r - l > 1) { int mid = (l + r) / 2; qq.clear(); rep(i, 1, mid) qq.push_back(pre[i]); if(query(qq)) r = mid; else l = mid; } return pre[r]; }

Compilation message (stderr)

eastereggs.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    5 | #pragma loop-opt(on)
      | 
eastereggs.cpp:24:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |             ^~~~
eastereggs.cpp:24:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |                     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...