Submission #671471

# Submission time Handle Problem Language Result Execution time Memory
671471 2022-12-13T05:47:04 Z Trunkty Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 464 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll

#include "grader.h"

vector<int> roads[515];
int nextnode=1, val[515];

void dfs(int x){
    val[x] = nextnode;
    nextnode++;
    for(int i:roads[x]){
        if(!val[i]){
            dfs(i);
        }
    }
}

int findEgg (int n, vector<pair<int,int>> bridges){
    for(pair<int,int> i:bridges){
        roads[i.first].push_back(i.second);
        roads[i.second].push_back(i.first);
    }
    dfs(1);
    int low=1,high=n,mid;
    while(low!=high){
        mid = (low+high)/2;
        vector<int> x;
        for(int i=1;i<=mid;i++){
            x.push_back(val[i]);
        }
        if(query(x)){
            high = mid;
        }
        else{
            low = mid+1;
        }
    }
    nextnode = 1;
    for(int i=1;i<=n;i++){
        roads[i].clear();
        val[i] = 0;
    }
    return low;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -