답안 #439495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
439495 2021-06-30T06:05:39 Z Yazan_Alattar Easter Eggs (info1cup17_eastereggs) C++14
40 / 100
22 ms 456 KB
#include <iostream>
#include <fstream>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <algorithm>


#include "grader.h"

using namespace std;

#define endl "\n"
#define F first
#define S second
#define pb push_back
typedef long long ll;
const int M = 550;
const int mod = 1e9+7;

vector <int> adj[M], path;

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

int findEgg (int N, vector < pair < int, int > > bridges)
{
    for (int i = 1; i <= N; i++) adj[i].clear();
	path.clear();
    for(auto i : bridges){
        adj[i.F].pb(i.S);
        adj[i.S].pb(i.F);
    }
    dfs(1, 0);

    int l = 0, r = N + 1;
    while(l < r){
        int mid = (l + r) / 2;
        vector <int> v;
		if(query(vector<int>(path.begin(), path.begin() + mid))) r = mid;
        else l = mid + 1;
    }
    return path[l - 1];
}

# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 336 KB Number of queries: 8
2 Correct 17 ms 332 KB Number of queries: 9
3 Correct 22 ms 328 KB Number of queries: 9
4 Correct 20 ms 328 KB Number of queries: 9
# 결과 실행 시간 메모리 Grader output
1 Partially correct 20 ms 352 KB Number of queries: 10
2 Correct 18 ms 336 KB Number of queries: 9
3 Runtime error 8 ms 448 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -