답안 #522361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522361 2022-02-04T16:47:16 Z ddy888 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
250 ms 131076 KB
#undef _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define fi first
#define si second
#define ar array
typedef pair<int,int> pi;
typedef tuple<int,int,int> ti;  
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#include "grader.h"

vector<int> adj[520], order;

void dfs(int x, int p) {
    order.pb(x);
    for (auto i: adj[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}

int findEgg (int n, vector < pair < int, int > > bridges)
{   
    for (auto i: bridges) {
        adj[i.fi].pb(i.si);
        adj[i.si].pb(i.fi);
    }
    dfs(1, -1);
    int lo = 0, hi = n + 1;
    while (lo + 1 < hi) {
        int mid = (lo + hi) / 2;
        vector<int> lq;
        for (int i = 1; i <= mid; ++i) lq.pb(order[i - 1]);
        if (query(lq)) hi = mid;
        else lo = mid;
    }
    return order[hi - 1];
}  
# 결과 실행 시간 메모리 Grader output
1 Runtime error 250 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 204 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 203 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -