Submission #31193

#TimeUsernameProblemLanguageResultExecution timeMemory
31193pasa3232Boxes with souvenirs (IOI15_boxes)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll n, k, l, 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++){ if(A[i] == 0) n--, A[i]=p[i]; 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:15: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...