Submission #660273

# Submission time Handle Problem Language Result Execution time Memory
660273 2022-11-21T12:27:36 Z a_aguilo Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
int findEgg (int N, vector < pair < int, int > > bridges)
{
    listaAdy = vector<vector<int>>(N+1);
    for(pair<int, int> bridge: bridges){
        listaAdy[bridge.second].push_back(bridge.first);
        listaAdy[bridge.first].push_back(bridge.second);
    }
    dfs(1, -1);
    int ans = N;
    int lo = 1; int hi = N-1;
    while(hi >= lo){
        int mid = lo + (hi - lo)/2;
        vector<int> ask(mid);
        for(int i = 0; i < mid; ++i) ask[i] = order[i];
        if(query(ask)){
            hi = mid-1;
            ans = mid;
        }
        else{
            lo = mid+1;
        }
    }
    return order[ans-1];
}

Compilation message

eastereggs.cpp:1:21: error: 'vector' has not been declared
    1 | int findEgg (int N, vector < pair < int, int > > bridges)
      |                     ^~~~~~
eastereggs.cpp:1:28: error: expected ',' or '...' before '<' token
    1 | int findEgg (int N, vector < pair < int, int > > bridges)
      |                            ^
eastereggs.cpp: In function 'int findEgg(int, int)':
eastereggs.cpp:3:5: error: 'listaAdy' was not declared in this scope
    3 |     listaAdy = vector<vector<int>>(N+1);
      |     ^~~~~~~~
eastereggs.cpp:3:16: error: 'vector' was not declared in this scope
    3 |     listaAdy = vector<vector<int>>(N+1);
      |                ^~~~~~
eastereggs.cpp:3:30: error: expected primary-expression before 'int'
    3 |     listaAdy = vector<vector<int>>(N+1);
      |                              ^~~
eastereggs.cpp:4:9: error: 'pair' was not declared in this scope
    4 |     for(pair<int, int> bridge: bridges){
      |         ^~~~
eastereggs.cpp:4:14: error: expected primary-expression before 'int'
    4 |     for(pair<int, int> bridge: bridges){
      |              ^~~
eastereggs.cpp:8:5: error: 'dfs' was not declared in this scope
    8 |     dfs(1, -1);
      |     ^~~
eastereggs.cpp:9:5: error: expected primary-expression before 'int'
    9 |     int ans = N;
      |     ^~~
eastereggs.cpp:8:16: error: expected ')' before 'int'
    8 |     dfs(1, -1);
      |                ^
      |                )
    9 |     int ans = N;
      |     ~~~         
eastereggs.cpp:4:8: note: to match this '('
    4 |     for(pair<int, int> bridge: bridges){
      |        ^
eastereggs.cpp:9:9: warning: unused variable 'ans' [-Wunused-variable]
    9 |     int ans = N;
      |         ^~~
eastereggs.cpp:13:16: error: expected primary-expression before 'int'
   13 |         vector<int> ask(mid);
      |                ^~~
eastereggs.cpp:14:38: error: 'ask' was not declared in this scope
   14 |         for(int i = 0; i < mid; ++i) ask[i] = order[i];
      |                                      ^~~
eastereggs.cpp:14:47: error: 'order' was not declared in this scope
   14 |         for(int i = 0; i < mid; ++i) ask[i] = order[i];
      |                                               ^~~~~
eastereggs.cpp:15:18: error: 'ask' was not declared in this scope
   15 |         if(query(ask)){
      |                  ^~~
eastereggs.cpp:15:12: error: 'query' was not declared in this scope
   15 |         if(query(ask)){
      |            ^~~~~
eastereggs.cpp:17:13: error: 'ans' was not declared in this scope
   17 |             ans = mid;
      |             ^~~
eastereggs.cpp:23:12: error: 'order' was not declared in this scope
   23 |     return order[ans-1];
      |            ^~~~~
eastereggs.cpp:23:18: error: 'ans' was not declared in this scope
   23 |     return order[ans-1];
      |                  ^~~