Submission #931146

# Submission time Handle Problem Language Result Execution time Memory
931146 2024-02-21T10:08:16 Z Amirreza_Fakhri Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
// In the name of the God

#include "gap.h"

#include <bits/stdc++.h>
#define ll long long
// #define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define pii pair <int, int>
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;

const int inf = 1e9+7;
const int mod = 998244353;
const ll maxn = 1e18;

ll a[100005];

ll findGap(int t, int n) {
    if (t == 1) {
        ll s = 1, e = maxn;
        for (ll l = 1, r = n; l <= r; l++, r--) {
            ll mn, mx;
            MinMax(s, e, &mn, &mx);
            a[l] = mn;
            a[r] = mx;
            s = mn + 1, e = mx - 1;
        }
        ll ans = 0;
        for (ll i = 2; i <= n; i++) smax(ans, a[i] - a[i-1]);
        return ans;
    }
    ll mn, mx;
    MinMax(0, maxn);
    ll g = (mn-mx+n-2)/(n-1);
    ll ans = g, l = mn;
    for (ll i = mn; i <= mx; i += g+1) {
        MinMax(i, min(i+g, mx), mn, mx);
        if (mn != -1) smax(ans, mn-l), l = mx;
    }
    return ans;
}

// int32_t main() {
//     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//     return 0;
// }











Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:19: error: too few arguments to function 'void MinMax(long long int, long long int, long long int*, long long int*)'
   39 |     MinMax(0, maxn);
      |                   ^
In file included from gap.cpp:3:
gap.h:1:6: note: declared here
    1 | void MinMax(long long, long long, long long*, long long*);
      |      ^~~~~~
gap.cpp:43:33: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   43 |         MinMax(i, min(i+g, mx), mn, mx);
      |                                 ^~
      |                                 |
      |                                 long long int
In file included from gap.cpp:3:
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:43:37: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   43 |         MinMax(i, min(i+g, mx), mn, mx);
      |                                     ^~
      |                                     |
      |                                     long long int
In file included from gap.cpp:3:
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*);
      |                                               ^~~~~~~~~~