Submission #31195

#TimeUsernameProblemLanguageResultExecution timeMemory
31195pasa3232Boxes with souvenirs (IOI15_boxes)C++14
100 / 100
563 ms274316 KiB
#include<bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll n, k, l, cnt, A[10000010], D[10000010], R[10000010], ans; long long delivery(int N, int K, int L, int p[]){ n=N, k=K, l=L; for(int i=0;i<n;i++){ A[i]=p[cnt++]; if(A[i] == 0) n--, A[i]=p[cnt++]; D[i]=(i<k?0:D[i-k])+min(l,A[i]*2); } ans=D[n-1]; for(int i=n-1;i>=0;i--){ R[i]=(i+k<n?R[i+k]:0)+(l-A[i])*2; ans=min(ans,R[i]+(i?D[i-1]:0)); } return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:16:13: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  for(int i=n-1;i>=0;i--){
            ~^~
#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...