# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1075501 | TB_ | 선물상자 (IOI15_boxes) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, n) for(ll i = 0; i<(n); i++)
#define F first
#define S second
#define deb(x) cout << #x << " = " << (x) << endl
#define deb2(x, y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
long long delivery(int N, int K, int L, int p[]) {
priority_queue<ll> pq;
fo(i, N){
pq.push(p[i]);
}
ll ans = 1e18;
ll res = 0;
while(!pq.empty()){
ll pos = 0;
fo(i, K){
ll next = pq.top();
pq.pop();
res+=min((next-pos+L)%L, (pos-next+L)%L);
}
ll next = 0;
res+=min((next-pos+L)%L, (pos-next+L)%L);
}
ans = res;
fo(i, N){
pq.push(-p[i]);
}
while(!pq.empty()){
ll pos = 0;
ll res = 0;
fo(i, K){
ll next = -pq.top();
pq.pop();
res+=min((next-pos+L)%L, (pos-next+L)%L);
}
ll next = 0;
res+=min((next-pos+L)%L, (pos-next+L)%L);
}
ans = min(res, ans);
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... |