답안 #766237

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
766237 2023-06-25T11:57:32 Z Ahmed57 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
3 ms 480 KB
#include "grader.h"

#include <bits/stdc++.h>

using namespace std;
int findEgg(int N, vector < pair < int, int > > bridges){
    queue<int> q;
    vector<int> adj[N+1];
    for(auto i:bridges){
        adj[i.first].push_back(i.second);
        adj[i.second].push_back(i.first);
    }
    q.push(1);
    int vis[N+1] = {0};
    vis[1] = 1;
    vector<int> lol;
    while(!q.empty()){
        int x= q.front();
        lol.push_back(x);
        q.pop();
        for(auto j:adj[x]){
            if(!vis[j]){
                q.push(j);vis[j] = 1;
            }
        }
    }
    int l = 1 , r = N , ans = 1e9;
    while(l<r){
        int mid = (l+r)/2;
        vector<int> xd;
        for(int i =0;i<mid;i++){
            xd.push_back(lol[i]);
        }
        if(query(xd)){
            ans = lol[mid-1];
            r = mid+1;
        }else l = mid;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 480 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -