답안 #483636

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
483636 2021-10-31T12:07:12 Z alexdumitru Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
245 ms 131076 KB
#include <bits/stdc++.h>
#include <grader.h>
using namespace std;
vector<int> v[550];
vector<int> parcurgere;
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,mi,dr;
    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;
        else st=mi+1;
    }
    return parcurgere[dr];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:13:12: warning: unused variable 'r' [-Wunused-variable]
   13 |     int st,r=N-1,mi,dr;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 245 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 188 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 184 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -