답안 #384482

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
384482 2021-04-01T17:52:06 Z ak2006 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
23 ms 620 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

#define pb push_back
using vi = vector<int>;
using vvi = vector<vi>;
vvi adj(513);
vi a;
void dfs(int i,int p)
{
    a.pb(i);
    for (int c:adj[i]){
        if (c != p)
            dfs(c,i);
    }
}
int findEgg(int n,vector<pair<int,int>>b)
{
    for (int i = 0;i<=512;i++)adj[i].clear();
    a.clear();
    for (pair<int,int> i : b)adj[i.first].pb(i.second),adj[i.second].pb(i.first);
    dfs(1,1);
    int l = 0,r = n - 1,ans = 0;
    while (l <= r){
        int mid = (l + r)/2;
        if (query(vector<int>(a.begin(),a.begin() + mid))){
            r = mid - 1;
        }
        else l = mid + 1,ans = mid;
    }
    return a[ans];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 364 KB Number of queries: 9
2 Correct 19 ms 364 KB Number of queries: 9
3 Correct 22 ms 364 KB Number of queries: 9
4 Runtime error 9 ms 620 KB Execution killed with signal 6
# 결과 실행 시간 메모리 Grader output
1 Partially correct 23 ms 364 KB Number of queries: 10
2 Correct 16 ms 364 KB Number of queries: 9
3 Runtime error 8 ms 548 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -