QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#839879 | #4. Gap | khoaduy | Compile Error | / | / | C++14 | 961b | 2025-01-02 11:28:57 | 2025-01-02 11:28:57 |
Judging History
answer
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
long long findGap(int T, int n)
{
long long limit=1e18;
if(T==1){
long long a[n+1];
MinMax(0LL,limit,&a[1],&a[n]);
int i=1,j=n;
while(j-i>=2){
MinMax(a[i]+1,a[j]-1,&a[i+1],&a[j-1]);
i++,j--;
}
long long ans=0;
for(int i=1;i<=n-1;i++){
ans=max(ans,a[i+1]-a[i]);
}
return ans;
}
else{
long long ans=0;
long long curr=-1;
long long lim;
MinMax(0,limit,&curr,&lim);
long long s=curr;
long long block=(lim-curr+n-2)/(n-1);
for(long long i=0;i<n-1;i++){
long long mn,mx;
MinMax(s+i*block+1,s+(i+1)*block,mn,mx);
if(mn!=-1){
ans=max(ans,mn-curr);
curr=mx;
}
}
return ans;
}
return 0;
}
Details
answer.code: In function ‘long long int findGap(int, int)’: answer.code:30:46: error: invalid conversion from ‘long long int’ to ‘long long int*’ [-fpermissive] 30 | MinMax(s+i*block+1,s+(i+1)*block,mn,mx); | ^~ | | | long long int In file included from answer.code:1: gap.h:2:35: note: initializing argument 3 of ‘void MinMax(long long int, long long int, long long int*, long long int*)’ 2 | void MinMax(long long, long long, long long*, long long*); | ^~~~~~~~~~ answer.code:30:49: error: invalid conversion from ‘long long int’ to ‘long long int*’ [-fpermissive] 30 | MinMax(s+i*block+1,s+(i+1)*block,mn,mx); | ^~ | | | long long int gap.h:2:47: note: initializing argument 4 of ‘void MinMax(long long int, long long int, long long int*, long long int*)’ 2 | void MinMax(long long, long long, long long*, long long*); | ^~~~~~~~~~