답안 #18652

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18652 2016-02-13T10:19:44 Z mindol 라멘 (JOI14_ramen) C++14
100 / 100
0 ms 1180 KB
#include "ramen.h"
#include<vector>
using namespace std;
vector<int> win,lose;
void Ramen(int N)
{
    for(int i=0,j=1;j<N;i+=2,j+=2)
    {
        int res=Compare(i,j);
        if(res==1) win.push_back(i), lose.push_back(j);
        else win.push_back(j), lose.push_back(i);
    }
    if(N&1) win.push_back(N-1), lose.push_back(N-1);
    for(int i=0;i<win.size()-1;i++)
    {
        int res=Compare(win[i],win[i+1]);
        if(res==1) win[i+1]=win[i];
    }
    for(int i=0;i<lose.size()-1;i++)
    {
        int res=Compare(lose[i],lose[i+1]);
        if(res==-1) lose[i+1]=lose[i];
    }
    Answer(lose.back(),win.back());
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<win.size()-1;i++)
                  ^
ramen.cpp:19:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<lose.size()-1;i++)
                  ^

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct