제출 #958713

#제출 시각아이디문제언어결과실행 시간메모리
958713aegHomecoming (BOI18_homecoming)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "homecoming.h"

using namespace std;

int64_t solve(int n, int k, int *a, int *b){
	int64_t ret = 0;
	int64_t maxi, cur, cost, nextcost;
	for(int it = 1; it <= 2; it++){
		cost = accumulate(b, b + k, 0ll);
		cur = a[0] - cost;
		maxi = (it == 1 ? INT64_MIN : 0);
		maxi = max(maxi, cur);
		for(int i = 1; i < n; i++){
			if(it == 2) nextcost = b[i + k - 1 - n];
			else if(i + k - 1 < n) nextcost = b[i + k - 1];
			else nextcost = 0;
			cost -= b[i - 1];
			cur = max(a[i] + cur - nextcost, a[i] - (cost + nextcost) + maxi);
			cost += nextcost;
			maxi = max(maxi, cur);
		}
		ret = max(maxi, ret);
	}
	return ret;
}

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

homecoming.cpp:6:9: error: ambiguating new declaration of 'int64_t solve(int, int, int*, int*)'
    6 | int64_t solve(int n, int k, int *a, int *b){
      |         ^~~~~
In file included from homecoming.cpp:2:
homecoming.h:4:11: note: old declaration 'long long int solve(int, int, int*, int*)'
    4 | long long solve(int N, int K, int *A, int *B);
      |           ^~~~~