답안 #1099472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099472 2024-10-11T11:17:01 Z Choco Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "grader.h"
#define ll long long
using namespace std;
vector<vector<int>>v(513);
vector<int>order;
vector<bool>check(513,0);
void dfs(int i){
    check[i]=1;
    order.push_back(i);
    for(int j=0;j<v[i].size();j++)
    if(!check[j])
    dfs(j);
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
    for(ll i=0;i<513;i++){
    v[i].clear();
    check[i]=0;
    }
    order.clear();
    for(int i=0;i<bridges.size();i++){
        int x=bridges[i].first;
        int y=bridges[i].second;
        v[i].push_back(y);
        v[y].push_back(x);
    }
    dfs(1);
    int l=0,r=N-1;
    while(l!=r){
        ll mid=(l+1+r)/2;
        if(query(vector<int>(order.begin(),order.begin()+mid)))
        r=mid-1;
        else
        l=mid;
    }
    return order[l];
}

Compilation message

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