제출 #419146

#제출 시각아이디문제언어결과실행 시간메모리
419146LouayFarah선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
#include "boxes.h"
using namespace std;

int delivery(int n, int k, int l, int positions[])
{
    if(k==1)
    {
        int res = 0;
        for(int i = 0; i<n; i++)
        {
            if(positions[i]>l/2)
            {
                res+=2*(l-positions[i]);
            }
            else
            {
                res+=2*(positions[i]);
            }
        }
        return res;
    }
    else if(k==n)
    {

    }
    else
    {

    }
}

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

boxes.cpp:5:5: error: ambiguating new declaration of 'int delivery(int, int, int, int*)'
    5 | int delivery(int n, int k, int l, int positions[])
      |     ^~~~~~~~
In file included from boxes.cpp:2:
boxes.h:4:11: note: old declaration 'long long int delivery(int, int, int, int*)'
    4 | long long delivery(int N, int K, int L, int p[]);
      |           ^~~~~~~~
boxes.cpp: In function 'int delivery(int, int, int, int*)':
boxes.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^