Submission #717311

#TimeUsernameProblemLanguageResultExecution timeMemory
717311tigarBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll dpcw[10000010], dpccw[10000010], pos[10000010]; ll delivery(ll N, ll K, ll L, ll* positions) { sort(positions, positions+N); for(int i=0; i<K; i++)dpccw[i]=min(L, 2*positions[i]); for(int i=K; i<N; i++)dpccw[i]=dpccw[i-K]+min(L, 2*positions[i]); for(int i=N-1; i>N-K; i--)dpcw[i]=min(L, (N-positions[i])*2); for(int i=N-K; i>=0; i--)dpcw[i]=dpcw[i+K]+min(L, (N-positions[i])*2); ll rezz=dpcw[0]; for(int i=0; i<N-1; i++)rezz=min(rezz, dpcw[i+1]+dpccw[i]); rezz=min(rezz, dpccw[N-1]); return rezz; } /*int main() { ll n, k, l; cin>>n>>k>>l; for(int i=0; i<n; i++)cin>>pos[i]; cout<<delivery(n, k, l, pos); return 0; }*/

Compilation message (stderr)

boxes.cpp: In function 'll delivery(ll, ll, ll, ll*)':
boxes.cpp:13:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   13 |     for(int i=K; i<N; i++)dpccw[i]=dpccw[i-K]+min(L, 2*positions[i]);
      |               ^
boxes.cpp:14:16: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   14 |     for(int i=N-1; i>N-K; i--)dpcw[i]=min(L, (N-positions[i])*2);
      |               ~^~
boxes.cpp:15:16: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   15 |     for(int i=N-K; i>=0; i--)dpcw[i]=dpcw[i+K]+min(L, (N-positions[i])*2);
      |               ~^~
/usr/bin/ld: /tmp/ccfNJ9cO.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status