Submission #918124

# Submission time Handle Problem Language Result Execution time Memory
918124 2024-01-29T13:12:09 Z Elvin_Fritl Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
146 ms 131072 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
const int N=2e5+5, mod=1e9+7;

int n;

#include "grader.h"

vector<int> d , g[N];

void dfs(int s,int p) {
    d.push_back(s);
    for(auto i: g[s]) {
        if(i == p) {
            continue;
        }
        dfs(i,s);
    }
}

int findEgg(int M , vector<pair<int , int>> a) {
    d.clear();
    n = M;
    for(int i=0;i<(int)a.size();i++) {
        g[a[i].first].push_back(a[i].second);
        g[a[i].second].push_back(a[i].first);
    }
    dfs(1 , 1);
    int l = 0 , r = n , best = -1;
    while(l <= r) {
        int mid = (l + r)>>1;
        vector<int> q;
        for(int i=0;i<mid;i++) {
            q.push_back(d[i]);
        }
        if(query(q) == 1) {
            r = mid - 1;
            best = mid;
        }
        else {
            l = mid + 1;
        }
    }
    return best;
}
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 10008 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 146 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 146 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -