QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#640595#4. GapDengDuckCompile Error//C++14702b2024-10-14 14:35:002024-10-14 14:35:01

Judging History

你现在查看的是最新测评结果

  • [2024-10-14 14:35:01]
  • 评测
  • [2024-10-14 14:35:00]
  • 提交

answer

#include<bits/stdc++.h> 
#include "gap.h"
#define LL long long
using namespace std;
const LL inf=1e18;
extern "C" void MinMax(LL,LL,LL*,LL*);
extern "C" LL  findGap(int op,int n)
{
	LL mx=0,s,t,ss,tt;		
	MinMax(0,inf,&s,&t);
	if(op==1)
	{
		n-=2;
		while(n>0)
		{
			MinMax(s+1,t-1,&ss,&tt);
			n-=2;
			mx=max({mx,ss-s,t-tt});
			s=ss,t=tt;
		}
		mx=max(mx,t-s);
		return mx;
	}
	else
	{
		
		LL k=(t-s)/(n-1);
		LL lst=s,L=s+1,R;
		while(L<t)
		{
			R=min(L+k-1,t-1);
			MinMax(L,R,&ss,&tt);
			if(ss==-1)
			{
				k=max(k,R-lst+1),L=R+1;
				continue;
			}
			mx=max(mx,ss-lst);
			k=max(k,mx);
			lst=tt,L=R+1;
		}	
		mx=max(mx,t-lst);
	}
	return mx;
}

Details

answer.code:6:17: error: conflicting declaration of ‘void MinMax(long long int, long long int, long long int*, long long int*)’ with ‘C’ linkage
    6 | extern "C" void MinMax(LL,LL,LL*,LL*);
      |                 ^~~~~~
In file included from answer.code:2:
gap.h:2:6: note: previous declaration with ‘C++’ linkage
    2 | void MinMax(long long, long long, long long*, long long*);
      |      ^~~~~~