# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
151948 | 2019-09-05T15:30:43 Z | erebos | 선물상자 (IOI15_boxes) | C++17 | 2 ms | 508 KB |
#include "boxes.h" #include <bits/stdc++.h> using namespace std; using ll=long long int; int n; inline int tozero(int idx) { return min(idx, n-idx); } long long delivery(int N, int K, int L, int p[]) { n=N; ll ans=0; for(int i=0; i<n; ++i) { if(p[i]>=K) { ans+=(p[i]/K)*(tozero(i)*2); p[i]%=K; } } int s, e=-1, i_have=K; for(int i=0; i<n; ++i) { if(p[i]) { if(i_have==K) { s=i; } else if(i_have>p[i]) { i_have-=p[i]; e=i; } else if(i_have==p[i]) { i_have=K; ans+=tozero(s)+tozero(i); e=-1; } else { s=i; i_have=i_have+K-(p[i]); ans+=tozero(s)+tozero(i); e=-1; } } } if(e!=-1) { ans+=tozero(e); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |