# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
47310 |
2018-04-30T13:35:10 Z |
Talant |
Gap (APIO16_gap) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include "gap.h"
#include "grader.cpp"
using namespace std;
const long long M = (1e6 + 5);
long long ans;
long long a[M];
long long l,r = 1e18;
long long ll,rr;
long long findGap(int T, int N)
{
if (T == 1 ) {
long long o = (N + 1) / 2;
ll = 1,rr = N;
while (o --) {
MinMax(l,r,&a[ll],&a[rr]);
l = a[ll] + 1,r = a[rr] - 1;
ll ++,rr --;
}
for (long long i = 1; i < N; i ++)
ans = max(ans,a[i + 1] - a[i]);
return ans;
}
else {
long long l = 0,r = 0;
MinMax(0,1e18,&l,&r);
long long last = l;
long long sz = (r - l - 1 + N - 2) / (N - 1);
long long s = l + 1,e = 0;
for (long long i = 1; i < N; i ++) {
e = s + sz - 1;
if (s > e)
break;
MinMax(s,e,&l,&r);
if (l != -1) {
ans = max(ans,l - last);
last = r;
}
s = e + 1;
}
return max(ans,(l - last));
}
}
Compilation message
/tmp/ccnRHJHS.o: In function `MinMax(long long, long long, long long*, long long*)':
grader.cpp:(.text+0x0): multiple definition of `MinMax(long long, long long, long long*, long long*)'
/tmp/cc41IcRj.o:gap.cpp:(.text+0x190): first defined here
/tmp/ccnRHJHS.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc41IcRj.o:gap.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status