Submission #54041

#TimeUsernameProblemLanguageResultExecution timeMemory
54041robertBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> using namespace std; int dtz(int a, int L){ return min(a, L-a); } int delivery(int N, int K, int L, int *p){ p[N] = 0; sort(p, p+N); p[N+1] = 0; long long ans = 0; for(int n=0; n<=N; n++){ ans = min(ans, a[n] + (L-a[n+1])); } return ans; }

Compilation message (stderr)

boxes.cpp: In function 'int delivery(int, int, int, int*)':
boxes.cpp:16:18: error: 'a' was not declared in this scope
   ans = min(ans, a[n] + (L-a[n+1]));
                  ^
boxes.cpp:18:9: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return ans;
         ^~~
boxes.cpp:10:25: warning: unused parameter 'K' [-Wunused-parameter]
 int delivery(int N, int K, int L, int *p){
                         ^