Submission #692402

# Submission time Handle Problem Language Result Execution time Memory
692402 2023-02-01T12:04:43 Z MateiKing80 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 592 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

vector<int>ord;
vector<int> v[600];
void dfs(int nod, int tata)
{
    ord.push_back(nod);
    for(int i=0;i<v[nod].size();i++)
    {
        if(v[nod][i]!=tata)
            dfs(v[nod][i],nod);
    }
}

int sus(int st, int dr)
{
    vector<int>vct;
    for(int i=st;i<=dr;i++)
        vct.push_back(ord[i]);
    int x=query( vct );
    return x;
}



int findEgg(int n, vector<pair<int, int> >  bridge)
{
    for(int i=0;i<n-1;i++)
    {
        v[bridge[i].first].push_back(bridge[i].second);
        v[bridge[i].second].push_back(bridge[i].first);
    }
    dfs(1,0);
    int poz=0, pas= (1<<(int)log2(n)) ;
    while(pas>0)
    {
        if(!sus(poz,poz+pas))
            poz=poz+pas+1;
        pas/=2;
    }
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:11:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i=0;i<v[nod].size();i++)
      |                 ~^~~~~~~~~~~~~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
   44 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -