# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
45453 |
2018-04-14T06:58:06 Z |
Unit |
Gap (APIO16_gap) |
C++14 |
|
0 ms |
0 KB |
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
ll findGap(int t,ll n)
{
ll s[100010];
if(t == 1)
{
ll l = -1,r = 1001001001001001001;
for(int i = 0; i < (n + 1) / 2; i++)
{
ll MAX,MIN;
MinMax(l,r,&MIN,&MAX);
s[i] = MIN;
s[N - 1 - i] = MAX;
l = MIN + 1;
r = MAX - 1;
}
ll res = 0;
for(int i = 1; i < n; i++)res = max(res,s[i] - s[i - 1]);
return res;
}
else
{
ll L,R;
MinMax(-1,1001001001001001001,&L,&R);
vector<ll> ele;
ele.push_back(L);
ele.push_back(R);
L++,R--;
ll MIN,MAX,dif = R - L + 1;
ll now = L;
for(int i = 0; i < dif % n; i++)
{
MinMax(now,now + dif / n,&MIN,&MAX);
if(MIN != -1)
{
ele.push_back(MIN);
ele.push_back(MAX);
}
now = now + dif / n + 1;
}
for(int i = 0; i < n - dif % n; i++)
{
MinMax(now,now + dif / n - 1,&MIN,&MAX);
if(MIN != -1)
{
ele.push_back(MIN);
ele.push_back(MAX);
}
now = now + dif / n;
}
sort(ele.begin(),ele.end());
ll res = 0;
for(int i = 1; i < ele.size(); i++)res = max(res,ele[i] - ele[i - 1]);
return res;
}
}
Compilation message
gap.cpp:5:1: error: 'll' does not name a type
ll findGap(int t,ll n)
^~