Submission #918386

# Submission time Handle Problem Language Result Execution time Memory
918386 2024-01-29T18:50:43 Z ayankarimova Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "grader.h"
#define ll long long
using namespace std;
const ll sz=600;
ll used[sz];
vector<ll>g[sz], vec;
ll dfs(ll u)
{
    vec.push_back(u);
    used[u]=1;
    for(auto v:g[u]){
        if(!used[v]){
            dfs(v);
        }
    }
}
int findEgg (int N, vector < pair < int, int > > br)
{
    /*
    if (query ({1})) return 1;
    return N;*/
    for(auto i:br){
        ll u=i.first;
        ll v=i.second;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1);
    ll l=0, r=N-1;
    while(l<=r){
        ll mid=(l+r)/2;
        vector<int>cur;
        for(int i=l; i<=mid; i++){
            cur.push_back(vec[i]);
        }
        int q=query(cur);
        if(q==1){
            r=mid;
        }
        else{
            l=mid+1;
        }
    }
    return vec[l];
}

Compilation message

eastereggs.cpp: In function 'long long int dfs(long long int)':
eastereggs.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -