Submission #522370

# Submission time Handle Problem Language Result Execution time Memory
522370 2022-02-04T17:00:32 Z ddy888 Easter Eggs (info1cup17_eastereggs) C++17
87 / 100
20 ms 368 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first    
#define si second
#define ar array
typedef pair<int,int> pi;
#include "grader.h"

vector<int> adj[520], order;

void dfs(int x, int p) {
    order.pb(x);
    for (auto i: adj[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}

int findEgg (int n, vector < pair < int, int > > bridges)
{   
    order.clear();
    for (int i = 1; i <= n; ++i) adj[i].clear();
    for (auto i: bridges) {
        adj[i.fi].pb(i.si);
        adj[i.si].pb(i.fi);
    }
    dfs(1, -1);
    int lo = 0, hi = n + 1;
    while (lo + 1 < hi) {
        int mid = (lo + hi) / 2;
        vector<int> lq;
        for (int i = 1; i <= mid; ++i) {
            assert(i - 1 < n);
			lq.pb(order[i - 1]);
        }
        if (query(lq)) hi = mid;
        else lo = mid;
    }
    return order[hi - 1];
}  

  
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 200 KB Number of queries: 5
2 Partially correct 1 ms 200 KB Number of queries: 5
3 Partially correct 1 ms 200 KB Number of queries: 5
4 Partially correct 1 ms 200 KB Number of queries: 5
# Verdict Execution time Memory Grader output
1 Correct 7 ms 324 KB Number of queries: 9
2 Correct 12 ms 336 KB Number of queries: 9
3 Correct 20 ms 332 KB Number of queries: 9
4 Correct 18 ms 340 KB Number of queries: 9
# Verdict Execution time Memory Grader output
1 Partially correct 17 ms 368 KB Number of queries: 10
2 Correct 14 ms 356 KB Number of queries: 9
3 Partially correct 20 ms 336 KB Number of queries: 10
4 Partially correct 13 ms 344 KB Number of queries: 10