Submission #1189910

#TimeUsernameProblemLanguageResultExecution timeMemory
1189910racha555Easter Eggs (info1cup17_eastereggs)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

void dfs(int u, vector<vector<int>> &adj, vector<vector<int>> &path, vector<bool> &visit)
{
    path[0].emplace_back(u);
    path[path[0].size()] = path[0];
    visit[u] = true;
    for (auto v : adj[u])
    {
        if ((visit[v] == false))
        {

            dfs(v, adj, path, visit);
        }
    }
}

int findEgg(int N, vector<pair<int, int>> bridges)
{
    // vector<vector<int>> adj(515), path(515);
    // vector<bool> visit(N + 1, false);
    // for (auto [u, v] : bridges)
    // {
    //     adj[u].emplace_back(v);
    //     adj[v].emplace_back(u);
    // }
    // dfs(1, adj, path, visit);

    // path[0].emplace_back(1);
    int l = 0, mid, r = N;
    // for (int i = 0; i <= N; i++)
    // {
    //     for (auto v : path[i])
    //     {
    //         cout << v << " ";
    //     }
    //     cout << "\n";
    // }
    while (l < r)
    {
        int mid = l + (r - l) / 2;
        if (query(path[mid]) == 1)
        {
            r = mid;
        }
        else
        {
            l = mid + 1;
        }
    }
    return path[r].back();
    // if (query ({1})) return 1;
    // return N;
}
// int main()
// {
//     cout << findEgg(5, {{1, 2}, {1, 3}, {2, 4}, {4, 5}});
// }

Compilation message (stderr)

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:45:19: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
   45 |         if (query(path[mid]) == 1)
      |                   ^~~~
      |                   std::filesystem::__cxx11::path
In file included from /usr/include/c++/11/filesystem:45,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
                 from eastereggs.cpp:1:
/usr/include/c++/11/bits/fs_path.h:248:9: note: 'std::filesystem::__cxx11::path' declared here
  248 |   class path
      |         ^~~~
eastereggs.cpp:54:12: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
   54 |     return path[r].back();
      |            ^~~~
      |            std::filesystem::__cxx11::path
In file included from /usr/include/c++/11/filesystem:45,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
                 from eastereggs.cpp:1:
/usr/include/c++/11/bits/fs_path.h:248:9: note: 'std::filesystem::__cxx11::path' declared here
  248 |   class path
      |         ^~~~