답안 #918502

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918502 2024-01-30T01:58:44 Z hacizadal Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
75 ms 131072 KB
#include <bits/stdc++.h>
#include "grader.h"
#define ll long long
#define pll pair<ll, ll>
using namespace std;
vector<ll>g[550], eggs;
ll used[550];

void dfs(ll v)
{
    eggs.push_back(v);
    for (auto u : g[v]){
        if (used[u] == 0){
            dfs(u);
        }
    }
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    for (ll i = 0; i<bridges.size(); i++){
        g[bridges[i].first].push_back(bridges[i].second);
        g[bridges[i].second].push_back(bridges[i].first);
    }
    dfs(1);
    ll l = 0, r = N - 1;
    while (l < r){
        ll m = (l + r)/2;
        vector<int>f;
        for (ll i = 0; i<m+1; i++){
            f.push_back(eggs[i]);
        }
        if (query(f)){
            r = m;
        }
        else {
            l = m + 1;
        }
    }
    return eggs[r+1];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:21:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (ll i = 0; i<bridges.size(); i++){
      |                    ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 75 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 70 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -