# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
467776 | Carmel_Ab1 | 선물상자 (IOI15_boxes) | C++17 | 14 ms | 308 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>vl;
#include "boxes.h"
#define all(x) x.begin(),x.end()
//#include "grader.cpp"
ll dst(ll x,ll y,ll l){
return min(abs(x-y),x+abs(l-1-y)+1);
}
ll delivery(int N, int K, int L, int P[]) {
ll n=N,k=K,l=L;
vl p(n);
for(int i=0; i<n; i++)
p[i]=P[i];
ll ans=1e18;
for(int i=-1; i<n ;i++){
ll cur=0,has=0,sum=0;
for(int j=0; j<=i; j++) {
if((j+1)%k==0 || j==i)
sum+=2*p[j];
}
has=0;
for(int j=n-1; j>i; j--){
has++;
if(has%k==0 || j==i+1)
sum+=2*(l-p[j]);
}
ans=min(ans,sum);
}
for(int i=-1; i<n; i++){
ll cur=0,has=0,sum=0;
for(int j=0; j<=i; j++) {
has++;
if(has%k==0 || j==i)
sum+=2*p[j];
}
while(has%k)
has++;
sum+=l;
int hass=0;
for(int j=n-1; j>has; j--){
hass++;
if(hass%k==0 || j==has+1)
sum+=2*(l-p[j]);
}
ans=min(ans,sum);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |