# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
759727 | 2023-06-16T16:21:01 Z | jay_jayjay | Easter Eggs (info1cup17_eastereggs) | C++14 | 30 ms | 360 KB |
// {{{1 extern "C" int __lsan_is_turned_off() { return 1; } #include <stdio.h> #include <stdlib.h> #include <math.h> #include <vector> #include <algorithm> #include <set> #include <map> #include <string> #include <iostream> #include <deque> using namespace std; #define ll long long #define inf 0x3f3f3f3f #define infl 0x3f3f3f3f3f3f3f3f #ifdef DEBUG #define dprintf(args...) fprintf(stderr,args) #include <assert.h> #endif #ifndef DEBUG #define dprintf(args...) 69 #define assert(args...) 42 #endif // 1}}} // pain im still so stupid int query(vector<int> islands); int findEgg(int n, vector<pair<int,int>> edges) { for(auto&[a,b]:edges)a--,b--; vector<vector<int>> adj(n); for(auto [a,b]:edges) adj[a].push_back(b),adj[b].push_back(a); vector<int> po; auto dfs = [&](auto& self, int u, int p=-1) -> void { po.push_back(u); for(auto v:adj[u])if(v!=p)self(self,v,u); }; dfs(dfs,0,0); vector<int> q; int l=0,r=n-1; while(l<r) { int m=l+(r-l)/2; //printf("%d %d %d\n",l,m,r); q.clear(); for(int i=0;i<=m;i++) q.push_back(1+po[i]) //,printf("%d ",po[i]) ; //printf("\n"); int x=query(q); if(x) r=m; else l=m+1; } return ++po[l]; } #undef DEBUG #ifdef DEBUG int main() { } #endif
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Number of queries: 4 |
2 | Correct | 1 ms | 208 KB | Number of queries: 4 |
3 | Correct | 1 ms | 208 KB | Number of queries: 4 |
4 | Correct | 1 ms | 208 KB | Number of queries: 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 336 KB | Number of queries: 8 |
2 | Correct | 12 ms | 348 KB | Number of queries: 9 |
3 | Correct | 20 ms | 360 KB | Number of queries: 9 |
4 | Correct | 13 ms | 336 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 352 KB | Number of queries: 9 |
2 | Correct | 12 ms | 336 KB | Number of queries: 9 |
3 | Correct | 30 ms | 336 KB | Number of queries: 9 |
4 | Correct | 18 ms | 356 KB | Number of queries: 9 |