답안 #5351

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5351 2014-04-05T18:09:05 Z model_code 라멘 (JOI14_ramen) C++
100 / 100
0 ms 1124 KB
#include "ramen.h"

void Ramen(int N) {
  int max_id, min_id, i;
  if(N%2 == 1) {
    max_id = min_id = N - 1;
  } else {
    if(Compare(N - 2, N - 1) > 0) {
      max_id = N - 2;
      min_id = N - 1;
    } else {
      max_id = N - 1;
      min_id = N - 2;
    }
  }
  for(i = 0; i < (N-1)/2; ++i) {
    int j, k;
    if(Compare(i * 2, i * 2 + 1) > 0) {
      j = i * 2;
      k = i * 2 + 1;
    } else {
      j = i * 2 + 1;
      k = i * 2;
    }
    if(Compare(j, max_id) > 0) {
      max_id = j;
    }
    if(Compare(k, min_id) < 0) {
      min_id = k;
    }
  }
  Answer(min_id, max_id);
}

Compilation message


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