답안 #330613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
330613 2020-11-26T00:18:22 Z jovan_b Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
3 ms 1520 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

vector <int> ord;
vector <int> graf[20005];

void dfs(int v, int par){
    ord.push_back(v);
    for(auto c : graf[v]){
        if(c != par) dfs(c, v);
    }
}

int kveri(int x){
    vector <int> qq;
    for(int i=1; i<=x; i++) qq.push_back(ord[i]);
    return query(qq);
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    for(int i=1; i<=N; i++) graf[i].clear();
    ord.clear();
    ord.push_back(0);
    for(auto c : bridges){
        graf[c.first].push_back(c.second);
        graf[c.second].push_back(c.first);
    }
    dfs(1, 0);
    int l = 1, r = N;
    while(l < r){
        int mid = (l+r+1)/2;
        if(kveri(mid)){
            r = mid-1;
        }
        else l = mid;
    }
    return ord[l];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1520 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1516 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1516 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -