답안 #781884

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781884 2023-07-13T12:38:30 Z ymm 라멘 (JOI14_ramen) C++17
100 / 100
1 ms 288 KB
#include "ramen.h"

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

Compilation message

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