# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
67757 | 2018-08-15T09:36:08 Z | theknife2001 | 선물상자 (IOI15_boxes) | C++17 | 2 ms | 380 KB |
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; const int N=1e7+55; long long dp[N][2]; int n; long long delivery(int N, int k, int L, int p[]) { n=N; int x; int temp=0; bool q=0; for(int i=0;i<n;i++) { x=k; while(x--&&i<n) { dp[i][0]=temp+p[i]; i++; } i--; temp+=p[i]+min(p[i],L-p[i]); } temp=0; for(int i=n-1;i>=0;i--) { x=k; while(x--&&i<n) { dp[i][1]=temp+(L-p[i]); i--; } i++; temp+=L-p[i]+min(p[i],L-p[i]); } long long ans=1e18; for(int i=0;i<n;i++) { ans=min(dp[i][0]+(i+1<n?dp[i+1][1]:0)+min(p[i],L-p[i])+(i+1<n?min(p[i+1],L-p[i+1]):0),ans); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 380 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Incorrect | 2 ms | 376 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Incorrect | 2 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |