Submission #283498

#TimeUsernameProblemLanguageResultExecution timeMemory
283498FlashGamezzzBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h"

long long delivery(int N, int K, int L, int p[]) {
    long n = N, k = K, l = L;
    long teams[10000002];
    teams[0] = 0;
    for (long i = 1; i <= n; i++){
	teams[i] = p[i];
    }
    teams[n+1] = l;
	long long ans = 1000000000000000000;
	for (long i = 0; i <= n; i++){
		long long t = 0;
		long j = i, count = 0;
		while (j >= 0){
			if (count == 0){
				t += 2*teams[j];
				count = k;
			}
			j--;
			count--;
		}
		j = i+1;
		count = 0;
		while (j <= n){
			if (count == 0){
				t += 2*(l-teams[j]);
				count = k;
			}
			j++;
			count--;
		}
		ans = min(ans, t);
	}
	return ans;
}

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:33:9: error: 'min' was not declared in this scope
   33 |   ans = min(ans, t);
      |         ^~~