답안 #875784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
875784 2023-11-20T13:36:39 Z Aiperiii Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
189 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector <int> g[513];
vector <int> tin;
void dfs(int v,int p){
    tin.push_back(v);
    for(auto to : g[v]){
        if(to!=p)dfs(to,v);
    }
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
    for(int i=0;i<bridges.size();i++){
        g[bridges[i].first].push_back(bridges[i].second);
        g[bridges[i].second].push_back(bridges[i].first);
    }
    dfs(1,-1);
    int l=0,r=N-1;
    while(l<r){
        int md=(l+r)/2;
        vector <int> check;
        for(int i=0;i<=md;i++)check.push_back(tin[i]);
        if(query(check))r=md;
        else l=md+1;
    }
    return tin[l];
}


Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:14:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i=0;i<bridges.size();i++){
      |                 ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 189 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 124 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 128 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -