답안 #5355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5355 2014-04-05T19:11:47 Z ainta 라멘 (JOI14_ramen) C++
100 / 100
0 ms 1124 KB
#include "ramen.h"
bool v1[410], v2[410];
void Ramen(int N) {
	int i, t, p, c, r1, r2;
	while (1){
		t = -1;
		c = 0;
		for (i = 0; i < N; i++){
			if (!v1[i]){
				c++;
				r1 = i;
				if (t == -1) t = i;
				else{
					p = Compare(t, i);
					if (p == 1) v1[i] = true, v2[t] = true;
					else v2[i] = true, v1[t] = true;
					t = -1;
				}
			}
		}
		if (c == 1)break;
	}
	while (1){
		t = -1;
		c = 0;
		for (i = 0; i < N; i++){
			if (!v2[i]){
				c++;
				r2 = i;
				if (t == -1) t = i;
				else{
					p = Compare(t, i);
					if (p == 1) v2[t] = true;
					else v2[i] = true;
					t = -1;
				}
			}
		}
		if (c == 1)break;
	}
	Answer(r2, r1);
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:41:16: warning: 'r2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  Answer(r2, r1);
                ^
ramen.cpp:41:16: warning: 'r1' 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 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