Submission #1351659

#TimeUsernameProblemLanguageResultExecution timeMemory
1351659garbacaEaster Eggs (info1cup17_eastereggs)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define pub push_back

using pii=pair<int,int>;
using vi=vector<int>;
using vpii=vector<pii>;
using vb=vector<bool>;

int findEgg(int n, vpii a)
{
    #include "grader.h"
    vi b; b.reserve(n);
    vvi c(n);
    for (auto i:a)
    {
        c[i.fi-1].pub(i.se-1);
        c[i.se-1].pub(i.fi-1);
    }
    queue<int> q; vb vis(n);
    q.push(0);
    while (!q.empty())
    {   
        int x{q.front()};
        q.pop(); b.pub(x+1);
        vis[x]=1;
        for (auto i:c[x])
        {
            if (!vis[i])
            {
                q.push(i);
            }
        }
    }
    int l{-1},r{n};
    while (l<r-1)
    {
        int mid{((l+r)>>1)};
        if (query(vi(b.begin(),b.begin()+mid)))
        {
            r=mid;
        }
        else
        {
            l=mid;
        }
    }
    return b[r];
}

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, vpii)':
eastereggs.cpp:15:5: error: 'vvi' was not declared in this scope; did you mean 'vi'?
   15 |     vvi c(n);
      |     ^~~
      |     vi
eastereggs.cpp:18:9: error: 'c' was not declared in this scope
   18 |         c[i.fi-1].pub(i.se-1);
      |         ^
eastereggs.cpp:18:13: error: 'struct std::pair<int, int>' has no member named 'fi'
   18 |         c[i.fi-1].pub(i.se-1);
      |             ^~
eastereggs.cpp:18:25: error: 'struct std::pair<int, int>' has no member named 'se'
   18 |         c[i.fi-1].pub(i.se-1);
      |                         ^~
eastereggs.cpp:19:13: error: 'struct std::pair<int, int>' has no member named 'se'
   19 |         c[i.se-1].pub(i.fi-1);
      |             ^~
eastereggs.cpp:19:25: error: 'struct std::pair<int, int>' has no member named 'fi'
   19 |         c[i.se-1].pub(i.fi-1);
      |                         ^~
eastereggs.cpp:28:21: error: 'c' was not declared in this scope
   28 |         for (auto i:c[x])
      |                     ^