Submission #483633

# Submission time Handle Problem Language Result Execution time Memory
483633 2021-10-31T11:56:52 Z alexdumitru Easter Eggs (info1cup17_eastereggs) C++11
0 / 100
234 ms 131076 KB
#include <bits/stdc++.h>
#include <grader.h>
using namespace std;
vector<int> v[550];
vector<int> parcurgere;
int query(vector<int> islands);
void dfs(int nod=1, int p=-1)
{
    parcurgere.push_back(nod);
    for(auto i:v[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;
    for(auto i:bridges)
    {
        v[i.first].push_back(i.second);
        v[i.second].push_back(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

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:14:18: warning: unused variable 'poz' [-Wunused-variable]
   14 |     int st,r=N-1,poz=N,mi,dr,i;
      |                  ^~~
eastereggs.cpp:14:30: warning: unused variable 'i' [-Wunused-variable]
   14 |     int st,r=N-1,poz=N,mi,dr,i;
      |                              ^
# Verdict Execution time Memory Grader output
1 Runtime error 234 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 198 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 197 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -