Submission #918356

# Submission time Handle Problem Language Result Execution time Memory
918356 2024-01-29T17:27:36 Z HaciyevAlik Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 488 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int mx=515;
vector<int> g[mx];
int a[mx],t;
void dfs(int u,int p) {
    a[++t]=u;
    for(int v:g[u]) {
        if(v!=p) dfs(v,u);
    }
}
int findEgg (int N,vector<pair<int,int>> bridges){
    for(int i=0;i<N-1;++i) {
        int u=bridges[i].first,v=bridges[i].second;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1,0);
    int l=1,r=N;
    while(l<=r) {
        int mid=(l+r)/2;
        vector<int> temp;
        for(int i=l;i<=mid;++i) temp.push_back(a[i]);
        if(query(temp)) {
            r=mid-1;
        } else {
            l=mid+1;
        }
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 11
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 488 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -