# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483630 | 2021-10-31T11:40:22 Z | alexdumitru | Easter Eggs (info1cup17_eastereggs) | C++14 | 1 ms | 484 KB |
#include <iostream> #include <vector> using namespace std; vector<int> v[550]; vector<int> parcurgere; int viz[550]; int query(vector<int> islands); void dfs(int nod) { int k=v[nod].size(); for(int i=0;i<k;i++) { if(!viz[v[nod][i]]) { viz[v[nod][i]]=1; parcurgere.push_back(v[nod][i]); dfs(v[nod][i]); } } } int findEgg(int N, vector<pair<int,int> > bridges) { int st=1,dr=N-1,rasp=-1,mi,i,m=bridges.size(),nr=1; for(i=1;i<=N;i++)viz[i]=0; for(i=0;i<m;i++) { v[bridges[i].first].push_back(bridges[i].second); v[bridges[i].second].push_back(bridges[i].first); } parcurgere.push_back(1); dfs(1); while(st<=dr) { mi=st+(dr-st)/2; vector<int> q; for(i=0;i<=mi;i++)q.push_back(i); if(query(q)) { dr=mi-1; rasp=mi; } else st=mi+1; } if(rasp==-1)return parcurgere[N]; return parcurgere[rasp]; } int query(vector<int> islands);
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 484 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |