Submission #857400

# Submission time Handle Problem Language Result Execution time Memory
857400 2023-10-06T06:53:27 Z chilinhxyzabc Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
// #include <bits/stdc++.h>
// #define ll long long
// #define infInt (int)1e9 + 1
// // #define infLL 0x3f3f3f3f3f3f
// #define infLL (int)1e17
// #define vt vector<int>
// #define vtt vector<vt>
// #define vttt vector<vtt>
// #define vtttt vector<vttt>
// #define pii pair<int, int>
// #define vpii vector<pii>
// #define endl '\n'
// #define all(a) a.begin(), a.end()
// #define _sort(a) sort(all(a))
// #define bsUp(a, x) upper_bound(all(a), x) - a.begin()
// #define bsLow(a, x) lower_bound(all(a), x) - a.begin()
// #define rev(a) reverse(all(a))
// #define uni(vals) vals.resize(distance(vals.begin(), unique(all(vals))))
// #define int ll
// // #define in(a); ; 
// // #define hi ;
// // #include "/home/phamngocthi/cp/see.cpp"
// using namespace std;

vt st;

void dfs(int u, int p, vector<vector<int>> &adj) {
    st.push_back(u);
    for(int v : adj[u]) {
        if(v == p)
            continue;
        dfs(v, u, adj);
    }
}

// int query(vector<int> islands) {
// }

int findEgg(int N, vector<pair<int,int>> bridges) {
    vector<vector<int>> adj(N + 1, vector<int>());
    for(auto[u, v] : bridges) {
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    st.clear();
    dfs(1, 0, adj);
    adj.clear();
    int l = 0, r = st.size() - 1, res;
    while(l <= r) {
        int m = (l + r) / 2;
        vector<int> a;
        for(int i = 0; i <= m; i++)
            a.push_back(st[i]);
        if(query(a)) {
            res = st[m];
            r = m - 1;
        } else {
            l = m + 1;
        }
    }
    return res;
}

// signed main() {
//     ios_base::sync_with_stdio(false);cin.tie(NULL);
// }

Compilation message

eastereggs.cpp:25:1: error: 'vt' does not name a type
   25 | vt st;
      | ^~
eastereggs.cpp:27:24: error: 'vector' has not been declared
   27 | void dfs(int u, int p, vector<vector<int>> &adj) {
      |                        ^~~~~~
eastereggs.cpp:27:30: error: expected ',' or '...' before '<' token
   27 | void dfs(int u, int p, vector<vector<int>> &adj) {
      |                              ^
eastereggs.cpp: In function 'void dfs(int, int, int)':
eastereggs.cpp:28:5: error: 'st' was not declared in this scope; did you mean 'std'?
   28 |     st.push_back(u);
      |     ^~
      |     std
eastereggs.cpp:29:17: error: 'adj' was not declared in this scope
   29 |     for(int v : adj[u]) {
      |                 ^~~
eastereggs.cpp: At global scope:
eastereggs.cpp:39:20: error: 'vector' has not been declared
   39 | int findEgg(int N, vector<pair<int,int>> bridges) {
      |                    ^~~~~~
eastereggs.cpp:39:26: error: expected ',' or '...' before '<' token
   39 | int findEgg(int N, vector<pair<int,int>> bridges) {
      |                          ^
eastereggs.cpp: In function 'int findEgg(int, int)':
eastereggs.cpp:40:5: error: 'vector' was not declared in this scope
   40 |     vector<vector<int>> adj(N + 1, vector<int>());
      |     ^~~~~~
eastereggs.cpp:40:19: error: expected primary-expression before 'int'
   40 |     vector<vector<int>> adj(N + 1, vector<int>());
      |                   ^~~
eastereggs.cpp:41:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   41 |     for(auto[u, v] : bridges) {
      |             ^
eastereggs.cpp:41:22: error: 'bridges' was not declared in this scope
   41 |     for(auto[u, v] : bridges) {
      |                      ^~~~~~~
eastereggs.cpp:42:9: error: 'adj' was not declared in this scope
   42 |         adj[u].push_back(v);
      |         ^~~
eastereggs.cpp:45:5: error: 'st' was not declared in this scope; did you mean 'std'?
   45 |     st.clear();
      |     ^~
      |     std
eastereggs.cpp:46:15: error: 'adj' was not declared in this scope
   46 |     dfs(1, 0, adj);
      |               ^~~
eastereggs.cpp:51:16: error: expected primary-expression before 'int'
   51 |         vector<int> a;
      |                ^~~
eastereggs.cpp:53:13: error: 'a' was not declared in this scope
   53 |             a.push_back(st[i]);
      |             ^
eastereggs.cpp:54:18: error: 'a' was not declared in this scope
   54 |         if(query(a)) {
      |                  ^
eastereggs.cpp:54:12: error: 'query' was not declared in this scope
   54 |         if(query(a)) {
      |            ^~~~~
eastereggs.cpp:55:13: error: 'res' was not declared in this scope
   55 |             res = st[m];
      |             ^~~
eastereggs.cpp:61:12: error: 'res' was not declared in this scope
   61 |     return res;
      |            ^~~