답안 #236052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
236052 2020-05-31T03:44:55 Z hhs2u 라멘 (JOI14_ramen) C++17
100 / 100
5 ms 384 KB
#include "ramen.h"

void Ramen(int N) {
    int a[222],b[222],cnt=0;
    int mx,mn;
    for(int i=0;i<N;i+=2)
    {
        if(i==N-1) a[cnt]=i,b[cnt]=i;
        else
        {
            if(Compare(i,i+1)==1) a[cnt]=i,b[cnt]=i+1;
            else b[cnt]=i,a[cnt]=i+1;
        }
        cnt++;
    }
    mx=a[0],mn=b[0];
    for(int i=1;i<cnt;i++)
    {
        if(Compare(a[i],mx)==1) mx=a[i];
    }
    for(int i=1;i<cnt;i++)
    {
        if(Compare(mn,b[i])==1) mn=b[i];
    }
    Answer(mn,mx);
    return;
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:16:7: warning: 'a[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
     mx=a[0],mn=b[0];
     ~~^~~~~
ramen.cpp:16:15: warning: 'b[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
     mx=a[0],mn=b[0];
             ~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct