답안 #754115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
754115 2023-06-06T18:00:38 Z thimote75 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 464 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

using idata = vector<int>;
using graph = vector<idata>;

using ipair  = pair<int, int>;
using ipdata = vector<ipair>;

graph roads;
idata tour;

void dfs (int node, int parent) {
    tour.push_back(node);

    for (int next : roads[node]) if (next != parent)
        dfs(next, node);
}

int query (int size) {
    idata query_tour(size);

    for (int i = 0; i < size; i ++)
        query_tour[i] = tour[i];
    
    return query(query_tour);
}

int result () {
    int a = 0;
    int b = tour.size();

    while (b - a > 1) {
        int c = (a + b) >> 1;

        if (query(c)) a = c;
        else b = c;
    }

    return tour[a - 1];
}

int findEgg (int N, ipdata bridges)
{
    roads.resize(N + 1);

    for (ipair bridge : bridges) {
        roads[bridge.first ].push_back(bridge.second);
        roads[bridge.second].push_back(bridge.first );
    }

    return result();
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -