# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
389561 | maximath_1 | Xylophone (JOI18_xylophone) | C++11 | 161 ms | 456 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "xylophone.h"
#include <vector>
#include <math.h>
#include <iostream>
#include <assert.h>
using namespace std;
int diff[5005];
int ans[5005];
void solve(int N){
for(int i = 2; i <= N; i ++){
if(i == 2) diff[i] = query(i - 1, i);
else{
int nw = query(i - 1, i), bf = query(i - 2, i);
if(abs(nw) + abs(diff[i - 1]) == bf){
diff[i] = nw;
if(diff[i - 1] < 0) diff[i] *= -1;
assert(abs(abs(diff[i - 1]) + abs(diff[i])) == bf);
}else{
diff[i] = nw;
if(diff[i - 1] > 0) diff[i] *= -1;
assert(max(abs(diff[i - 1]), abs(diff[i])) == bf);
}
}
}
ans[1] = 1;
for(int i = 2; i <= N; i ++)
ans[i] = diff[i] + ans[i - 1];
int mn = 69696969, mx = -69696969, mnid = 0, mxid = 0;
for(int i = 1; i <= N; i ++){
if(mn > ans[i]){
mn = ans[i]; mnid = i;
}
if(mx < ans[i]){
mx = ans[i]; mxid = i;
}
}
for(int i = 1; i <= N; i ++)
ans[i] += -mn + 1;
if(mnid > mxid){
ans[1] = 1;
for(int i = 2; i <= N; i ++)
ans[i] = -diff[i] + ans[i - 1];
int mn = 69696969, mx = -69696969, mnid = 0, mxid = 0;
for(int i = 1; i <= N; i ++){
if(mn > ans[i]){
mn = ans[i]; mnid = i;
}
if(mx < ans[i]){
mx = ans[i]; mxid = i;
}
}
for(int i = 1; i <= N; i ++)
ans[i] += -mn + 1;
}
for(int i = 1; i <= N; i ++)
answer(i, ans[i]);
}
컴파일 시 표준 에러 (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... |