Submission #404622

#TimeUsernameProblemLanguageResultExecution timeMemory
404622DaktoBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; int delivery(int n, int k, int l, int V[]){ vector<int> v(V, V+n); 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, int*)':
boxes.cpp:8:13: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
    8 |     n=v.size();
      |       ~~~~~~^~
boxes.cpp:5:32: warning: unused parameter 'l' [-Wunused-parameter]
    5 | int delivery(int n, int k, int l, int V[]){
      |                            ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...