이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 = inf;
for(int i=0; i<N; i++)rez = min(rez, clockwise[i] + cclockwise[(i+1)%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... |