Submission #283518

#TimeUsernameProblemLanguageResultExecution timeMemory
283518FlashGamezzzBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
2079 ms256 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <utility> #include <vector> #include "boxes.h" using namespace std; long long delivery(int N, int K, int L, int p[]) { long long ans = 1000000000000000000; for (long i = 0; i < K && i < N; i++){ long long t = min(L, min(2*p[i], 2*(L-p[0]))); long l = i+1, r = i+K-1; while (true){ if (r >= N){ if (l < N){ r = N-1; t += min(L, min(2*p[r], 2*(L-p[l]))); } break; } t += min(L, min(2*p[r], 2*(L-p[l]))); l += K; r += K; } ans = min(ans, t); } cout << ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
#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...