This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "boxes.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
//#define endl "\n"
#define pii pair<int,int>
using namespace std;
const int MAXN = 1e7+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;
long long clockwise[MAXN];
long long cclockwise[MAXN];
long long delivery(int N, int K, int L, int p[]) {
for(int i=0; i<N; i++)clockwise[i] = min(p[i]*2, L), cclockwise[i] = min((L-p[i]) * 2, L);
//for(int i=0; i<N; i++)cout << clockwise[i] << " ";cout << endl;
//for(int i=0; i<N; i++)cout << cclockwise[i] << " ";cout << endl;
for(int i=K; i<N; i++)clockwise[i] += clockwise[i-K];
for(int i=N-K-1; i>=0; i--)cclockwise[i] += cclockwise[i+K];
//for(int i=0; i<N; i++)cout << clockwise[i] << " ";cout << endl;
//for(int i=0; i<N; i++)cout << cclockwise[i] << " ";cout << endl;
long long rez = min(clockwise[N-1], cclockwise[0]);
for(int i=0; i<N-1; i++)rez = min(rez, clockwise[i] + cclockwise[i%N]);
return rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |