답안 #18863

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18863 2016-02-16T05:43:00 Z choyi0521 라멘 (JOI14_ramen) C++14
50 / 100
0 ms 1124 KB
#include "ramen.h"
bool a[400], b[400];
void Ramen(int N) {
	bool flag;
	do {
		flag = false;
		for (int i = 0; i < N - 1; i++) {
			for (int j = i + 1; j < N; j++) {
				if (!a[i] && !a[j] || !b[i] && !b[j]) {
					flag = true;
					int c=Compare(i, j);
					if (c == 1) b[j]=a[i] = true;
					else b[i] = a[j] = true;
				}
			}
		}
	} while (flag);
	int p1, p2;
	for (int i = 0; i < N; i++) {
		if (!a[i]) p1 = i;
		if (!b[i]) p2 = i;
	}
	Answer(p1, p2);
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:9:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if (!a[i] && !a[j] || !b[i] && !b[j]) {
               ^
ramen.cpp:23:16: warning: 'p2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  Answer(p1, p2);
                ^
ramen.cpp:23:16: warning: 'p1' may be used uninitialized in this function [-Wmaybe-uninitialized]

# 결과 실행 시간 메모리 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 Incorrect 0 ms 1124 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -