# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483638 | 2021-10-31T12:25:38 Z | alexdumitru | Easter Eggs (info1cup17_eastereggs) | C++14 | 233 ms | 131076 KB |
#include <iostream> #include <vector> #include <grader.h> using namespace std; vector<int> a[550]; vector<int> parcurgere; int viz[550]; int query(vector<int> islands); void dfs(int nod=1, int p=-1) { parcurgere.push_back(nod); for(auto i:a[nod])if(i!=p)dfs(i,nod); } int findEgg(int N, vector<pair<int,int> > bridges) { int st,r=N-1,poz=N,mi,dr,i,m=bridges.size(); for(i=1;i<=N;i++)viz[i]=0; for(i=0;i<m;i++) { a[bridges[i].first].push_back(bridges[i].second); a[bridges[i].second].push_back(bridges[i].first); } dfs(); st=0; dr=N-1; while(st<=dr) { mi=st+(dr-st)/2; if(query(vector<int>(parcurgere.begin(),parcurgere.begin()+mi+1))) { dr=mi-1; r=mi; } else st=mi+1; } return parcurgere[r]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 233 ms | 131076 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 188 ms | 131076 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 187 ms | 131076 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |