# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
403018 | monus1042 | 선물상자 (IOI15_boxes) | C++17 | 2058 ms | 34636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 8e18;
ll subtwo(int N, int K, int L, int p[]){
ll answer = 0;
if (L==1) return answer;
int mxd = L/2;
int cnt = 0, cntright = 0;
for (int i=0; i<N; i++){
if (p[i] <= mxd) cnt++;
if ((p[i] == 0 || p[i] >= mxd+1) && N%2==1) cntright++;
else if ((p[i] == 0 || p[i] >= mxd) && N%2==0) cntright++;
}
if (cnt == N) return 2LL*p[N-1];
if (cntright == N) return 2LL*(L-p[0]);
answer = L;
ll maxleft, maxright;
maxleft = maxright = 0;
for (int i=0; i<N; i++){
if (p[i] <= mxd){
maxleft = max(maxleft,(ll)p[i]);
}else{
maxright = max(maxright, (ll)L-p[i]);
}
}
ll answer2 = maxleft*2LL + maxright*2LL;
answer = min(answer, answer2);
컴파일 시 표준 에러 (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... |