답안 #262939

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
262939 2020-08-13T11:17:06 Z dolphingarlic 라멘 (JOI14_ramen) C++14
100 / 100
1 ms 256 KB
#include "ramen.h"
#include <algorithm>

void Ramen(int N) {
    int lo = -1, hi = -1;
    if (N & 1) lo = hi = N - 1;
    for (int i = 0; i < N - 1; i += 2) {
        if (~Compare(i, i + 1)) {
            if (hi == -1 || ~Compare(i, hi)) hi = i;
            if (lo == -1 || ~Compare(lo, i + 1)) lo = i + 1;
        } else {
            if (hi == -1 || ~Compare(i + 1, hi)) hi = i + 1;
            if (lo == -1 || ~Compare(lo, i)) lo = i;
        }
    }
    Answer(lo, hi);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct