답안 #1084403

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084403 2024-09-06T08:10:07 Z MMihalev Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include<iostream>
#include<algorithm>
#include<cmath>
#include "gap.h"
using namespace std;
long long Mi,Ma;
long long findGap(int T, int N)
{
    if(T>=1)
    {
        long long l=0,r=1000000000000000000LL,prevMi=-1,prevMa=-1;
        long long ans=0;
        int rem=N;
        while(rem>0)
        {
            MinMax(l,r,Mi,Ma);
            if(rem==2)ans=max(ans,Mi-Ma);
            if(prevMi!=-1)
            {
                ans=max(ans,Mi-prevMi);
                ans=max(ans,prevMa-Ma);
            }
            if(Mi!=Ma)rem-=2;
            else rem--;
            prevMi=Mi;
            prevMa=Ma;
        }
        return ans;
    }
    else
    {

    }
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:16:24: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   16 |             MinMax(l,r,Mi,Ma);
      |                        ^~
      |                        |
      |                        long long int
In file included from gap.cpp:4:
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:16:27: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   16 |             MinMax(l,r,Mi,Ma);
      |                           ^~
      |                           |
      |                           long long int
In file included from gap.cpp:4:
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:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^