답안 #18875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18875 2016-02-16T10:11:01 Z chan492811 라멘 (JOI14_ramen) C++
80 / 100
0 ms 1128 KB
#include "ramen.h"
int max_arr[500],min_arr[500],max1,min1;
int n;
void Ramen(int N) {
    int i;
    if(N==1){ Answer(0,0); return; }
    for(i=0;i<N-1;i+=2){
        if(Compare(i,i+1)==1) max_arr[i/2]=i,min_arr[i/2]=i+1;
        else max_arr[i/2]=i+1,min_arr[i/2]=i;
    }
    n=N/2;
    max1=max_arr[0]; min1=min_arr[0];
    for(i=1;i<n;i++){
        if(Compare(max1,max_arr[i])==-1) max1=max_arr[i];
        if(Compare(min1,min_arr[i])==1) min1=min_arr[i];
    }
    if(n%2==1){
        if(Compare(max1,N-1)==-1) max1=N-1;
        if(Compare(min1,N-1)==1) min1=N-1;
    }
    Answer(min1,max1);
}

Compilation message


# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1128 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct