# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
545755 | | AJ00 | Gap (APIO16_gap) | C++14 | | 2921 ms | 1396 KiB |
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 <bits/stdc++.h>
#include "gap.h"
using namespace std;
long long int findGap(int T, int n){
long long int f = 0,r=1e18,i=0,mn,mx,ans=0;
while((i<(n/2))){
MinMax(f,r,&mn,&mx);
// cout << mn << " " << mx << "\n";
if (n==2 && i==0){
ans = mx-mn;
return ans;
}
if (i){
ans = max(ans,mn-f+1);
ans = max(ans,r-mx+1);
}
i++;
f = mn+1;
r = mx-1;
}
if (n%2==1){
MinMax(f,r,&mn,&mx);
// cout << mn << " " << mx << "\n";
ans = max(ans,mn-f+1);
ans = max(ans,r-mx+1);
}
cout << ans << " ";
// return ans;
// cout << mn << " " << mx << "\n";
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
30 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |