Submission #404620

#TimeUsernameProblemLanguageResultExecution timeMemory
404620DaktoBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int delivery(int n, int k, int l, vector<int> v){ v.erase(v.begin(),lower_bound(v.begin(),v.end(),1)); n=v.size(); vector<int> ps; int c=0; for(int i=0; i<n; i++){ ps.push_back(min(2*v[i], n)+c); if((i-1)%k==0){ c+=min(2*v[i],n); } } int res=ps[n-1]; c=0; int j=0; for(int i=n-1; i>=0; i++, j++){ res=min(res,ps[i-1]+min(2*v[i], n)+c); if((j-1)%k==0){ c+=min(2*v[i],n); } } return res; }

Compilation message (stderr)

boxes.cpp: In function 'int delivery(int, int, int, std::vector<int>)':
boxes.cpp:7:13: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
    7 |     n=v.size();
      |       ~~~~~~^~
boxes.cpp:5:32: warning: unused parameter 'l' [-Wunused-parameter]
    5 | int delivery(int n, int k, int l, vector<int> v){
      |                            ~~~~^
/usr/bin/ld: /tmp/ccGMg0Wh.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status