Submission #283522

#TimeUsernameProblemLanguageResultExecution timeMemory
283522FlashGamezzzBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
575 ms164084 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <utility> #include <vector> #include "boxes.h" using namespace std; long teams[10000000]; long long delivery(int N, int K, int L, int p[]) { long n = N, k = K, len = L; long long ans = 1000000000000000000; for (long i = 0; i < n; i++){ teams[i] = p[i]; } for (long i = 0; i < k && i < n; i++){ long long t = min(len, min(2*teams[i], 2*(len-teams[0]))); long l = i+1, r = i+k; while (true){ if (r >= n){ if (l < n){ r = n-1; t += min(len, min(2*teams[r], 2*(len-teams[l]))); } break; } t += min(len, min(2*teams[r], 2*(len-teams[l]))); l += k; r += k; } ans = min(ans, t); } return ans; }
#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...