# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
852057 |
2023-09-21T07:41:36 Z |
8pete8 |
Gap (APIO16_gap) |
C++17 |
|
0 ms |
0 KB |
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include "gap.h"
using namespace std;
#define ll long long
#define f first
#define endl "\n"
//#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define int long long
const int mxn=1e5,mod=1000000007,lg=20,root=1000,inf=1e18;
int findGap(int T,int N){
int mn,mx;
MinMax(1,1e18,&mn,&mx);
if(N==2)return mx-mn;
int ans=0;
if(T==1){
int lmn=mn,lmx=mx;
while(mn<mx){
MinMax(lmn+1,lmx-1,&mn,&mx);
ans=max({ans,mn-lmn,lmx-mx});
lmn=mn;
lmx=mx;
if(mn==-1)break;
}
return ans;
}
ans=((mx-mn-1)+(N-2))/(N-2);//min max gap
int add=0,cur=mn;
for(int i=0;i<N;i++){
MinMax(cur+1,cur+ans,&mn,&mx);
if(mn==-1)add+=(ans);
else cur=mx,ans=max(ans,add+(mn-cur));
}
return ans;
}
Compilation message
/usr/bin/ld: /tmp/ccZxJnWO.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status