Submission #560750

#TimeUsernameProblemLanguageResultExecution timeMemory
560750tamthegodGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include<iostream> #include<iomanip> #include<algorithm> #include<stack> #include<queue> #include<string> #include<string.h> #include<cmath> #include<vector> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<cstdio> #include<bitset> #include<chrono> #include<random> #include<ext/rope> /* ordered_set #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> */ #define pb push_back #define fi first #define se second using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; const int maxN = 1e6 + 5; const int mod = 1e9 + 7; const ll oo = 1e18; ll a[maxN]; ll findGap(int T, int n) { memset(a, -1, sizeof a); if(T == 1) { int low = 1, high = n; a[n + 1] = (ll)2e18 + 1; while(low <= high) { MinMax(a[low - 1] + 1, a[high + 1] - 1, &a[low], &a[high]); low++; high--; } ll res = 0; for(int i=2; i<=n; i++) res = max(res, a[i] - a[i - 1]); return res; } else { for(int i=1; i<=n; i++) { ll low = a[i - 1] + 1, high = oo, mid; while(low <= high) { mid = (low + high) / 2; int p, q; MinMax(a[i - 1] + 1, mid, &p, &q); if(q != p) high = mid - 1; else low = mid + 1; } a[i] = low; } for(int i=2; i<=n; i++) res = max(res, a[i] - a[i - 1]); return res; } }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:65:43: error: cannot convert 'int*' to 'long long int*'
   65 |                 MinMax(a[i - 1] + 1, mid, &p, &q);
      |                                           ^~
      |                                           |
      |                                           int*
In file included from gap.cpp:1:
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:72:13: error: 'res' was not declared in this scope
   72 |             res = max(res, a[i] - a[i - 1]);
      |             ^~~
gap.cpp:73:16: error: 'res' was not declared in this scope
   73 |         return res;
      |                ^~~