# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
79393 | 2018-10-13T03:42:36 Z | Plurm | 선물상자 (IOI15_boxes) | C++11 | 4 ms | 376 KB |
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int p[]) { vector<int> a,b; for(int i = 0; i < N; i++){ if(p[i] < L-p[i]){ a.push_back(p[i]); }else{ b.push_back(L-p[i]); } } sort(a.begin(),a.end()); sort(b.begin(),b.end()); vector<long long> dpa,dpb; dpa.resize(a.size()); if(!a.empty()) dpa[0] = 2ll*a[0]; long long mn = (long long)(N+K-1)/(long long)K*(long long)L; for(int i = 1; i < a.size(); i++){ mn = min(mn,dpa[i-1] + (long long)(N-i+K-1)/(long long)K*(long long)L); dpa[i] = i >= K ? dpa[i-K] : 0ll; dpa[i] += 2ll*(long long)a[i]; } if(!a.empty()){ mn = min(mn,dpa[a.size()-1] + (long long)(N+a.size()+K-1)/(long long)K*(long long)L); } dpb.resize(b.size()); if(!b.empty()) dpb[0] = 2ll*b[0]; for(int i = 1; i < b.size(); i++){ mn = min(mn,dpb[i-1] + (long long)(N-i+K-1)/(long long)K*(long long)L); for(int j = 0; j < a.size(); j++){ mn = min(mn,dpa[j] + dpb[i-1] + (long long)(N-i-j+K-2)/(long long)K*(long long)L); } dpb[i] = i >= K ? dpb[i-K] : 0ll; dpb[i] += 2ll*(long long)b[i]; } if(!b.empty()){ mn = min(mn,dpb[b.size()-1] + (long long)(N-b.size()+K-1)/(long long)K*(long long)L); for(int j = 0; j < a.size(); j++){ mn = min(mn,dpa[j] + dpb[b.size()-1] + (long long)(N-b.size()-j+K-2)/(long long)K*(long long)L); } } return mn; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 376 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 | Incorrect | 2 ms | 376 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 | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |