# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
619570 | Mounir | Scales (IOI15_scales) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define chmax(x, v) x = max(x, v)
#define chmin(x, v) x = min(x, v)
#define pii pair<int, int>
#define pb push_back
#define sz(x) (int)x.size()
#define x first
#define y second
#define int long long
using namespace std;
const int OO = 1e18;
int delivery(signed nTeams, signed bSup, signed nSections, signed p[]) {
int doGauche[nTeams], doDroite[nTeams];
for (int i = 0; i < nTeams; ++i){
doGauche[i] = min(nSections, 2 * p[i]);
if (i >= bSup)
doGauche[i] += doGauche[i - bSup];
}
for (int i = nTeams - 1; i >= 0; --i){
doDroite[i] = min(nSections, 2 * (nSections - p[i]));
if (i + bSup <= nTeams - 1)
doDroite[i] += doDroite[i + bSup];
}
int mini = OO;
for (int i = -1; i < nTeams; ++i){
int cur = 0;
if (i != -1)
cur += doGauche[i];
if (i != nTeams - 1)
cur += doDroite[i + 1];
chmin(mini, cur);
}
return mini;
}