제출 #249357

#제출 시각아이디문제언어결과실행 시간메모리
249357sahil_kGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include "gap.h" #include <iostream> #include <algorithm> #include <cmath> using namespace std; long long findGap (int t, int n) { if (t == 1) { long long mn, mx; MinMax(0, 1e18, &mn, &mx); long long p_mn = mn, p_mx = mx; long long ans = 0; for (int i=1; i<(n+1)/2; i++) { MinMax(p_mn+1, p_mx-1, &mn, &mx); ans = max(ans, mn-p_mn); ans = max(ans, p_mx-mx); p_mn = mn; p_mx = mx; } ans = max(ans, mx-mn); return ans; } else { long long mn, mx; MinMax(0, 1e18, &mn, &mx); if (n == 2) return mx-mn; long long sz = ceil((mx-mn-1)/(n-1)); long long prev_mx = -1; long long ans = 0; for (long long i=mn+1; i<mx; i+=sz) { MinMax(i, i+sz, mn, mx); if (prev_mx > -1) ans = max(ans, mn-prev_mx); if (mx > -1) prev_mx = mx; } return ans; } }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:29:26: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(i, i+sz, mn, mx);
                          ^
In file included from gap.cpp:1:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:29:26: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(i, i+sz, mn, mx);
                          ^
In file included from gap.cpp:1:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~