# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
65283 | 2018-08-07T09:57:21 Z | KHUSRAV | 선물상자 (IOI15_boxes) | C++14 | 3 ms | 376 KB |
#include "boxes.h" #include<bits/stdc++.h> using namespace std ; long long delivery(int N, int K, int L, int p[]) { int l = -1 ; int r = N ; long long ans = 1e18 ; while(l + 1 < r){ int m = (l + r) / 2 ; if(p[m] <= L / 2) l = m ; else r = m ; } for(int i = 0 ; i <= N ; i ++){ long long s = 0 ; for(int j = l ; j >=0 ; j -= K){ s = s + 2 * p[j]; if(p[j] > L / 2){ cout << 1 / 0 ; } } for(int j = r ; j < N ; j += K){ s = s + 2 * (L - p[j]); if(p[j] <= L / 2){ cout << 1 / 0 ; } } ans = min(ans , i * L + s); for(int j = 1 ; j <= K ; j ++){ if(l >= 0 && r < N){ if(L / 2 - p[l] <= p[r] - L / 2){ l -- ; } else r ++ ; } else if(l >= 0) l -- ; else if(r < N) r ++ ; } } return ans ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | Output isn't correct |
4 | 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 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |