답안 #756718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
756718 2023-06-12T06:35:49 Z andrei_marciuc Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 592 KB
#include <iostream>
#include <vector>
#include <bitset>
#include "grader.h"

using namespace std;

const int MAX = 514;

vector<int> adj[ MAX ];
vector<int> island;
vector<int> parc;
bitset<MAX + 2> ok;

void dfs( int nod = 1 ) {
    ok[ nod ] = 1;
    parc.push_back( nod );
    for( const int nxt : adj[ nod ] )
        if( !ok[ nxt ] )
            dfs( nxt );
}

int findEgg( int n, vector<pair<int, int>> bridges ) {
    for( const auto muchie : bridges ) {
        adj[ muchie.first ].push_back( muchie.second );
        adj[ muchie.second ].push_back( muchie.first );
    }

    dfs();

    int left = 0;
    int right = parc.size() - 1;
    while( left < right ) {
        int med = ( left + right ) / 2;
        
        island.clear();
        for( int i = left; i <= med; i++ )
            island.push_back( parc[ i ] );

        if( query( island ) )
            right = med;
        else left = med + 1;
    }
    return right;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -