Submission #1122408

#TimeUsernameProblemLanguageResultExecution timeMemory
1122408heeyBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
1 ms516 KiB
#include<bits/stdc++.h> #define f first #define s second #define all(x) (x).begin(), (x).end() #define mod 1'000'000'007 #define inf 1'000'000'000'000'00 #define pb push_back #define vvi vector<vi> using namespace std; #include "boxes.h" long long delivery(int N, int K, int L, int p[]){ int res = 0; int d = 0; int i = 0; int j = N-1; while(i <= j){ int c = K; int prev = 0; while(i <= j && i < N && c > 0){ res += 2*(p[i] - prev); d++; c--; prev = p[i]; i++; if(i != N && p[i] - prev > L - p[i]) break; } //right c = K; prev = L; while(i <= j && j >= 0 && c > 0){ res += 2*(prev - p[j]); d++; c--; prev = p[j]; j--; if(j > 0 && prev - p[j] > p[j]) break; } } return res; }
#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...