Submission #990905

# Submission time Handle Problem Language Result Execution time Memory
990905 2024-05-31T18:56:31 Z RaduM Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
1 ms 600 KB
#include "grader.h"
#include <bits/stdc++.h>

using namespace std;
//int query(vector < int > islands){
//    return 1;
//}
vector <int> ord;
vector < vector <int> > G(513);
void dfs(int nod, int t){
    ord.push_back(nod);
    for(auto x : G[nod]){
        if(x == t) continue;
        dfs(x, nod);
    }
}
int findEgg(int n, vector < pair < int, int > > bridges){
    for(auto x : bridges){
        G[x.first].push_back(x.second);
        G[x.second].push_back(x.first);
    }
    dfs(1,0);
    int st = 1, dr = n,poz = 1;
    while(st <= dr){
        int med = (st + dr) >> 1;
        if(query(vector <int> (ord.begin() + st, ord.begin() + med))){
            poz = med;
            st = med + 1;
        }
        else dr = med - 1;
    }
    return poz;
}

//vector < pair <int, int> > v;
//int main()
//{
//    int n,x,y;
//    ios_base::sync_with_stdio(false);
//    cin.tie(nullptr);
//    cin >> n;
//    for(int i = 1; i < n; i++){
//        cin >> x >> y;
//        v.push_back({x,y});
//    }
//    cout << findEgg(n, v);
//    return 0;
//}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -