답안 #484563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484563 2021-11-04T12:02:33 Z MohamedFaresNebili Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 456 KB
#include <bits/stdc++.h>
#include "grader.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
 
        using namespace std;
 
        using ll  = long long;
        using vi  = vector<int>;
 
        #define pb push_back
        #define ff first
        #define ss second
        #define lb lower_bound
        #define all(x) (x).begin() , (x).end()
 
        vector<int>adj[555], id;
        void dfs(int v, int p) {
            id.pb(v);
            for(auto u: adj[v]) { 
                if(u == p) continue;
                dfs(u, v);
            }
        }
 
        int findEgg (int N, vector < pair < int, int > > bridges)
        {
            for(int l = 1; l <= N; l++) adj[l].clear();
            id.clear();
            for(auto u : bridges) {
                int a = u.ff, b = u.ss;
                adj[a].pb(b); adj[b].pb(a);
            }
            dfs(1, 1);
            int lo = 0, hi = N - 1;
            while(lo != hi) {
                int md = (lo + hi)/2;
                if(query(vector<int>(id.begin() + lo, id.begin() + md))) hi = md - 1;
                else lo = md;
            }
            return id[lo];
        }
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -