Submission #283499

#TimeUsernameProblemLanguageResultExecution timeMemory
283499FlashGamezzzBoxes 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 = std::min(ans, t);
	}
	return ans;
}

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:33:14: error: 'min' is not a member of 'std'
   33 |   ans = std::min(ans, t);
      |              ^~~