Submission #61652

# Submission time Handle Problem Language Result Execution time Memory
61652 2018-07-26T09:03:17 Z EntityIT Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
5 ms 792 KB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

#define pb push_back
#define fi first
#define se second
typedef pair<int, int> ii;

const int N = 600;
int a[N], cur;
vector<int> gr[N];

void dfs(int u, int p) {
    a[++cur] = u;
    for (int v : gr[u]) if(v != p) dfs(v, u);
}

int findEgg(int n, vector<ii> edge) {
    for (ii i : edge) {
        gr[i.fi].pb(i.se); gr[i.se].pb(i.fi);
    }
    dfs(1, 1);

    vector<int> ask;
    int l = 1, r = n;

    while(l < r) {
        int mid = l + r >> 1;
        ask.clear();
        for (int i = 1; i <= mid; ++i) ask.pb(a[i]);
        if(query(ask)) r = mid;
        else l = mid + 1;
    }
    return a[l];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:30:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid = l + r >> 1;
                   ~~^~~
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 420 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 608 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -