답안 #963100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963100 2024-04-14T14:08:15 Z biank Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
164 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

const int MAX_N = 512;

vector<int> adj[MAX_N], islands;

void dfs(int u, int p = -1) {
    islands.push_back(u + 1);
    for (int v : adj[u]) {
        if (v != p) dfs(v, u);
    }
}

int findEgg (int N, vector<pair<int, int>> bridges) {
    islands.clear();
    for (int i = 0; i < N - 1; i++) {
        auto [u, v] = bridges[i];
        --u, --v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(0);
    int l = 0, r = N;
    while (l + 1 < r) {
        int m = (l + r) / 2;
        if (query(vector<int>(begin(islands) + l, begin(islands) + m))) {
            r = m;
        } else {
            l = m;
        }
    }
    return islands[l];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:20:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   20 |         auto [u, v] = bridges[i];
      |              ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1532 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 476 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 164 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -