# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1011709 | pawned | 선물상자 (IOI15_boxes) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
ll delivery(int n, int kg, int lg, int p[]) {
ll N = n; ll K = kg; ll L = lg;
// length is L, have N teams, distribute K at a time
ll cut = L / 2;
vi leftv; // [0, cut]
vi rightv; // [cut + 1, L - 1];
sort(p, p + N);
for (int i = 0; i < N; i++) {
if (p[i] <= cut) {
if (p[i] != 0)
leftv.pb(p[i]);
}
else {
rightv.pb(L - p[i]);
}
}
/* cout<<"leftv: ";
for (ll x : leftv)
cout<<x<<" ";
cout<<endl;
cout<<"rightv: ";
for (ll x : rightv)
cout<<x<<" ";
cout<<endl;*/
int X = (int)(leftv.size());
int Y = (int)(rightv.size());
ll mincost = 1e18;
ll cost = 0;
for (int i = X - 1; i >= 0; i -= K) {
cost += leftv[i] * 2;
}
for (int i = Y - 1; i >= 0; i -= K) {
cost += rightv[i] * 2;
}
mincost = cost;
for (int i = 1; i < K; i++) { // count remove in left
if (X < i || Y < (N - i))
continue;
cost = L;
for (int j = X - i - 1; j >= 0; j -= K) {
cost += leftv[j] * 2;
}
for (int j = Y - (N - i) - 1; j >= 0; j -= K) {
cost += rightv[j] * 2;
}
mincost = min(mincost, cost);
}
return mincost;
}
컴파일 시 표준 에러 (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... |