Submission #61723

# Submission time Handle Problem Language Result Execution time Memory
61723 2018-07-26T12:47:16 Z nvmdava Boxes with souvenirs (IOI15_boxes) C++17
Compilation error
0 ms 0 KB
#include "boxes.h"

long long delivery(int N, int K, int L, int p[]) {
	long long ans = (long long)(N + K - 1) / K * L
	
	int i;
	while(p[i] == 0)i++;
	i += K - 1;
	while(i < n && p[i] * 2 < L){
		ans = ans - L + p[i] * 2
		i+=k;
	}
	i = n - k;
	while(i >= 0 && (L -p[i]) * 2 < L){
		ans = ans - L + (L - p[i]) * 2;
	}
	return ans;
}

Compilation message

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:6:2: error: expected ',' or ';' before 'int'
  int i;
  ^~~
boxes.cpp:7:10: error: 'i' was not declared in this scope
  while(p[i] == 0)i++;
          ^
boxes.cpp:8:2: error: 'i' was not declared in this scope
  i += K - 1;
  ^
boxes.cpp:9:12: error: 'n' was not declared in this scope
  while(i < n && p[i] * 2 < L){
            ^
boxes.cpp:13:6: error: 'n' was not declared in this scope
  i = n - k;
      ^
boxes.cpp:13:10: error: 'k' was not declared in this scope
  i = n - k;
          ^