QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#839879#4. GapkhoaduyCompile Error//C++14961b2025-01-02 11:28:572025-01-02 11:28:57

Judging History

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

  • [2025-01-02 11:28:57]
  • 评测
  • [2025-01-02 11:28:57]
  • 提交

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*);
      |                                               ^~~~~~~~~~