Submission #1094278

#TimeUsernameProblemLanguageResultExecution timeMemory
1094278minggaGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "gap.h" using namespace std; #define ln "\n" #define dbg(x) cout << #x << " = " << x << ln #define mp make_pair #define pb push_back #define fi first #define se second #define inf 2e18 #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define out(file) freopen(file, "w", stdout) #define in(file) freopen(file, "r", stdin) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define int long long int MOD = 1e9 + 7; int findGap(int T, int N) { if(T == 1) { int mn, mx; int lb = 0, rb = 1e18; int l = 0, r = N - 1; vector<int> a(N, 0); while(l <= r) { MinMax(lb, rb, mn, mx); a[l] = mn, a[r] = mx; lb = mn + 1, rb = mx - 1; l++, r--; } int ans = 0; for(int i = 1; i < n; i++) ans = max(ans, a[i] - a[i - 1]); return ans; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(long long int, long long int)':
gap.cpp:30:28: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   30 |             MinMax(lb, rb, mn, mx);
      |                            ^~
      |                            |
      |                            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:30:32: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   30 |             MinMax(lb, rb, mn, mx);
      |                                ^~
      |                                |
      |                                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:37:28: error: 'n' was not declared in this scope
   37 |         for(int i = 1; i < n; i++) ans = max(ans, a[i] - a[i - 1]);
      |                            ^
gap.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^