Submission #1232327

#TimeUsernameProblemLanguageResultExecution timeMemory
1232327marselelGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
using ll = long long;
int findGap() {
    set<int> st;
    ll s = -1, t = 2e18;
    ll mn = 0, mx = 0;
    while (mn <= mx) {
        MinMax(s, t, mn, mx);
        if (mn == -1 && mx == -1) {
            break;
        }
        st.insert(mn);
        st.insert(mx);
        s = mn + 1;
        t = mx - 1;
    }    
    vector<int> a;
    for (auto v : st) {
        a.push_back(v);
    }
    ll ans = 0;
    for (int i = 1; i < (int)a.size(); ++i) {
        ans = max(ans, a[i] - a[i - 1]);
    }
    return ans;
}

Compilation message (stderr)

gap.cpp: In function 'int findGap()':
gap.cpp:3:5: error: 'set' was not declared in this scope
    3 |     set<int> st;
      |     ^~~
gap.cpp:3:9: error: expected primary-expression before 'int'
    3 |     set<int> st;
      |         ^~~
gap.cpp:7:9: error: 'MinMax' was not declared in this scope
    7 |         MinMax(s, t, mn, mx);
      |         ^~~~~~
gap.cpp:11:9: error: 'st' was not declared in this scope; did you mean 't'?
   11 |         st.insert(mn);
      |         ^~
      |         t
gap.cpp:16:5: error: 'vector' was not declared in this scope
   16 |     vector<int> a;
      |     ^~~~~~
gap.cpp:16:12: error: expected primary-expression before 'int'
   16 |     vector<int> a;
      |            ^~~
gap.cpp:17:19: error: 'st' was not declared in this scope; did you mean 't'?
   17 |     for (auto v : st) {
      |                   ^~
      |                   t
gap.cpp:18:9: error: 'a' was not declared in this scope
   18 |         a.push_back(v);
      |         ^
gap.cpp:21:30: error: 'a' was not declared in this scope
   21 |     for (int i = 1; i < (int)a.size(); ++i) {
      |                              ^
gap.cpp:22:15: error: 'max' was not declared in this scope; did you mean 'mx'?
   22 |         ans = max(ans, a[i] - a[i - 1]);
      |               ^~~
      |               mx