제출 #390923

#제출 시각아이디문제언어결과실행 시간메모리
390923BlagojceGap (APIO16_gap)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int i_inf = 1e9; const ll inf = 1e18; const ll mod = 1e9+7; const ld eps = 1e-13; const ld pi = 3.14159265359; const int mxn = 1e5; #include "gap.h" /* int n; ll A[mxn]; void MinMax(ll s, ll t, ll &mn, ll &mx){ mn = -1; mx = -1; fr(i, 0, n){ if(A[i] >= s){ if(A[i] <= t) mn = A[i]; break; } } for(int i = n-1; i >= 0; i --){ if(A[i] <= t){ if(A[i] >= s) mx = A[i]; break; } } } */ long long findGap(int T, int N) { ll a1, an; MinMax(0, inf, a1, an); ll d = (an - a1)/(N-1); ll pr = a1; ll ans = 0; for(int i = 0; i*d <= an; i++){ ll ai, aj; MinMax(i*d, min((i+1)*d, an), ai, aj); if(ai != -1){ ans = max(ans, ai-pr); pr = aj; } } return ans; } /* int main(){ cin >> n; fr(i, 0, n) cin >> A[i]; cout<<findGap(2, n)<<endl; }*/

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:49:17: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   49 |  MinMax(0, inf, a1, an);
      |                 ^~
      |                 |
      |                 ll {aka long long int}
In file included from gap.cpp:22:
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:49:21: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   49 |  MinMax(0, inf, a1, an);
      |                     ^~
      |                     |
      |                     ll {aka long long int}
In file included from gap.cpp:22:
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:60:33: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   60 |   MinMax(i*d, min((i+1)*d, an), ai, aj);
      |                                 ^~
      |                                 |
      |                                 ll {aka long long int}
In file included from gap.cpp:22:
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:60:37: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   60 |   MinMax(i*d, min((i+1)*d, an), ai, aj);
      |                                     ^~
      |                                     |
      |                                     ll {aka long long int}
In file included from gap.cpp:22:
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*);
      |                                               ^~~~~~~~~~