This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll findGap(int T, int N)
{
if(T == 1){
ll a, b;
MinMax(1, 1e18, &a, &b);
if(N == 2){
return b - a;
}
ll ans = 1;
ll _a, _b;
while(a < b){
_a = a, _b = b;
MinMax(a + 1, b - 1, &a, &b);
if(a == -1 || b == -1) break;
ans = max(a - _a, ans);
ans = max(_b - b, ans);
}
if(a < b){
ans = max(ans, b - a);
}
if((a == -1 || b == -1) && (_a < _b)){
ans = max(ans, _b - _a);
}
return ans;
}
else{
}
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
36 | }
| ^
gap.cpp:29:31: warning: '_b' may be used uninitialized in this function [-Wmaybe-uninitialized]
29 | ans = max(ans, _b - _a);
| ~~~^~~~
gap.cpp:29:31: warning: '_a' may be used uninitialized in this function [-Wmaybe-uninitialized]
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |