Submission #1083364

# Submission time Handle Problem Language Result Execution time Memory
1083364 2024-09-03T03:23:19 Z dong_gas Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll = long long;

ll a[100201];
ll l[100201], r[100201];
pll b[100201];
const ll inf = 1'000'000'000'000'000'000;

ll findGap(ll T, ll n) {
    ll mn, mx, ret = 0;
    MinMax(0, inf, mn, mx);
    a[1] = mn, a[n] = mx;
    ll gap = (mx - mn) / n;
    for (ll i = a[1], cnt = 1; cnt <= n; i += gap, cnt++) {
        l[cnt] = i, r[cnt] = i + gap;
        if (cnt == n) r[cnt] = a[n];
    }
    bool full = true;
    for (int i = 1; i <= n; i++) {
        MinMax(l[i], r[i], mn, mx);
        b[i] = {mn, mx};
        if (mn == -1) full = false;
        ret = max(ret, mx - mn);
    }
    if (full) {
        for (int i = 2; i <= n; i++) {
            MinMax(b[i].first - b[i - 1].first, mn, mx);
            ret = max(ret, mx - mn);
        }
    } 
    else {
        ll bef = -1;
        for (int i = 1; i <= n; i++) {
            if (b[i].first == -1) continue;
            MinMax(bef, b[i].first, mn, mx);
            ret = max(ret, mx - mn);
            bef = b[i].second;
        }
    }
    return ret;
}

Compilation message

gap.cpp:8:1: error: 'pll' does not name a type; did you mean 'll'?
    8 | pll b[100201];
      | ^~~
      | ll
gap.cpp: In function 'll findGap(ll, ll)':
gap.cpp:13:20: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   13 |     MinMax(0, inf, mn, mx);
      |                    ^~
      |                    |
      |                    ll {aka long long int}
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:13:24: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   13 |     MinMax(0, inf, mn, mx);
      |                        ^~
      |                        |
      |                        ll {aka long long int}
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:22:28: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   22 |         MinMax(l[i], r[i], mn, mx);
      |                            ^~
      |                            |
      |                            ll {aka long long int}
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:22:32: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   22 |         MinMax(l[i], r[i], mn, mx);
      |                                ^~
      |                                |
      |                                ll {aka long long int}
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:23:9: error: 'b' was not declared in this scope
   23 |         b[i] = {mn, mx};
      |         ^
gap.cpp:29:20: error: 'b' was not declared in this scope
   29 |             MinMax(b[i].first - b[i - 1].first, mn, mx);
      |                    ^
gap.cpp:36:17: error: 'b' was not declared in this scope
   36 |             if (b[i].first == -1) continue;
      |                 ^
gap.cpp:37:25: error: 'b' was not declared in this scope
   37 |             MinMax(bef, b[i].first, mn, mx);
      |                         ^