제출 #709282

#제출 시각아이디문제언어결과실행 시간메모리
709282groshiGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include<iostream> #include "gap.h" using namespace std; long long a[200000]; /*void MinMax(long long x,long long y,int *l,int *r) { cout<<x<<" "<<y<<"\n"; cin>>*l>>*r; }*/ long long findGap(int t,int n) { if(t==1) { int l,r; MinMax(0,(long long)1e18,&l,&r); a[1]=l; a[n]=r; int pocz=2,kon=n-1; while(pocz<=kon) { MinMax(a[pocz-1]+1,a[kon+1]-1,&l,&r); a[pocz]=l; a[kon]=r; pocz++; kon--; } long long wynik=0; for(int i=1;i<n;i++) wynik=max(wynik,a[i+1]-a[i]); return wynik; } else{ } }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:15:34: error: cannot convert 'int*' to 'long long int*'
   15 |         MinMax(0,(long long)1e18,&l,&r);
      |                                  ^~
      |                                  |
      |                                  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:21:43: error: cannot convert 'int*' to 'long long int*'
   21 |             MinMax(a[pocz-1]+1,a[kon+1]-1,&l,&r);
      |                                           ^~
      |                                           |
      |                                           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:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^