Submission #1207005

#TimeUsernameProblemLanguageResultExecution timeMemory
1207005jasonicGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define fastIO cin.tie(0); ios::sync_with_stdio(false)

ll findGap(int T, ll N) {
    ll mn = 0, mx = 1e18;
    queue<ll> left, right;

    while(true) {
        ll l, r;
        minMax(mn, mx, l, r);
        if(l == r) {
            left.push(l);
        } else {
            left.push(l);
            right.push(r);
        }
        
        mn = l + 1;
        mx = r - 1;

        if(size(left) + size(right) == N) break;
    }

    vector<ll> a;
    while(!left.empty()) {
        a.push_back(left.top());
        left.pop();
    }

    while(!right.empty()) {
        a.push_back(right.top());
        right.pop();
    }

    ll ans = 0;
    for(int i = 1; i < N; i++) {
        ans = max(ans, a[i] - a[i-1]);
    }
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, long long int)':
gap.cpp:14:9: error: 'minMax' was not declared in this scope; did you mean 'MinMax'?
   14 |         minMax(mn, mx, l, r);
      |         ^~~~~~
      |         MinMax
gap.cpp:30:26: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   30 |         a.push_back(left.top());
      |                          ^~~
      |                          pop
gap.cpp:35:27: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   35 |         a.push_back(right.top());
      |                           ^~~
      |                           pop
gap.cpp:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^