# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918903 | 2024-01-30T17:40:47 Z | Moonn | Easter Eggs (info1cup17_eastereggs) | C++17 | 2 ms | 1068 KB |
#include<bits/stdc++.h> #define inti long long #define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; vector<vector<int>>v; vector<bool>ch; vector<int>g; int query(vector<int> islands); void dfs(int n,int x) { ch[x]=1; for(int i:v[x]) { if(!ch[i]) dfs(n,i); } g.push_back(x); } int findEgg(int n, vector < pair < int, int > > bridges) { v.resize(n+1); ch.resize(n+1,0); for(int i=0;i<bridges.size();i++) { int a=bridges[i].first; int b=bridges[i].second; v[a].push_back(b); v[b].push_back(a); } dfs(n,1); int l,r,mid; l=0; r=g.size()-1; vector<int>vi; while(l<r) { vi.clear(); mid=(l+r)/2; for(int i=0;i<=mid;i++) vi.push_back(g[i]); if(query(vi)) r=mid; else l=mid+1; } return g[l]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 436 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 464 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1068 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |