제출 #623687

#제출 시각아이디문제언어결과실행 시간메모리
623687sword060Gap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int q,int x){ if(q==2){ long long l=0,r=1e18,ans=0; MinMax(l,r,l,r); if(x==2)return r-l; long long xd=l,dist=0,lol=(r-l+x-2)/(x-1); while(xd<r){ cout<<ans<<endl; long long c1,c2; MinMax(xd+1,xd+1+lol,c1,c2); if(c1==-1){ dist+=lol+1; xd+=lol+1; }else{ ans=max(ans,dist+c1-xd); dist=0; xd=c1; } } return ans; }else{ vector<long long>a; long long c=0,v=1e18,zz=x; while(zz&&c<=v){ long long l,r; MinMax(c,v,l,r); if(l==-1)break; a.push_back(l);if(l!=r)a.push_back(r); c=l+1;v=r-1;zz-=2; } sort(a.begin(),a.end()); long long ret=0; for(int i=0;i<(int)a.size()-1;i++)ret=max(ret,a[i+1]-a[i]); return ret; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:7:16: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    7 |     MinMax(l,r,l,r);
      |                ^
      |                |
      |                long long int
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:7:18: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    7 |     MinMax(l,r,l,r);
      |                  ^
      |                  |
      |                  long long int
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:13:28: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |       MinMax(xd+1,xd+1+lol,c1,c2);
      |                            ^~
      |                            |
      |                            long long int
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:13:31: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |       MinMax(xd+1,xd+1+lol,c1,c2);
      |                               ^~
      |                               |
      |                               long long int
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:29:18: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   29 |       MinMax(c,v,l,r);
      |                  ^
      |                  |
      |                  long long int
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:29:20: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   29 |       MinMax(c,v,l,r);
      |                    ^
      |                    |
      |                    long long int
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~