Submission #918061

# Submission time Handle Problem Language Result Execution time Memory
918061 2024-01-29T13:00:51 Z raul2008487 Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
#define ll long long
#define vl vector<ll>
#define fi first
#define se second
using namespace std;
vl adj[sz];
vl et;
void dfs(ll node, ll p){
    et.pb(node);
    for(auto edge: adj[node]){
        if(edge == p){continue;}
        dfs(edge, v);
    }
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
    ll i, j;
    for(i=0;i<bridges.size();i++){
        adj[bridges[i].fi].push_back(bridges[i].se);
        adj[bridges[i].se].push_back(bridges[i].fi);
    }
    dfs(1);
    ll lo = 0, hi = N - 1, mid, best = 0;
    while(lo <= hi){
        mid = (lo + hi) >> 1;
        vl t;
        for(i = lo; i<=mid; i++){
            t.pb(et[i]);
        }
        if(query(t)){
            best = mid;
            hi = mid - 1;
        }
        else{
            lo = mid + 1;
        }
    }
    cout << best << endl;
}

Compilation message

eastereggs.cpp:8:8: error: 'sz' was not declared in this scope; did you mean 'se'?
    8 | vl adj[sz];
      |        ^~
      |        se
eastereggs.cpp: In function 'void dfs(long long int, long long int)':
eastereggs.cpp:11:8: error: 'class std::vector<long long int>' has no member named 'pb'
   11 |     et.pb(node);
      |        ^~
eastereggs.cpp:12:20: error: 'adj' was not declared in this scope
   12 |     for(auto edge: adj[node]){
      |                    ^~~
eastereggs.cpp:14:19: error: 'v' was not declared in this scope
   14 |         dfs(edge, v);
      |                   ^
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:20:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(i=0;i<bridges.size();i++){
      |             ~^~~~~~~~~~~~~~~
eastereggs.cpp:21:9: error: 'adj' was not declared in this scope
   21 |         adj[bridges[i].fi].push_back(bridges[i].se);
      |         ^~~
eastereggs.cpp:24:10: error: too few arguments to function 'void dfs(long long int, long long int)'
   24 |     dfs(1);
      |          ^
eastereggs.cpp:10:6: note: declared here
   10 | void dfs(ll node, ll p){
      |      ^~~
eastereggs.cpp:30:15: error: 'class std::vector<long long int>' has no member named 'pb'
   30 |             t.pb(et[i]);
      |               ^~
eastereggs.cpp:32:18: error: could not convert 't' from 'vector<long long int>' to 'vector<int>'
   32 |         if(query(t)){
      |                  ^
      |                  |
      |                  vector<long long int>
eastereggs.cpp:19:11: warning: unused variable 'j' [-Wunused-variable]
   19 |     ll i, j;
      |           ^
eastereggs.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^