Submission #136328

# Submission time Handle Problem Language Result Execution time Memory
136328 2019-07-25T07:05:56 Z 임유진(#3261) Meandian (CEOI06_meandian) C++14
100 / 100
7 ms 376 KB
#include "libmean.h"

static const int MAXN = 105;

static int ans[MAXN];

int main() {
	int N = Init();
	int a[5] = {1, 2, 3, 4, 0};

	for(int i = 1; i <= N; i++) ans[i] = -1;
	for(int i = 5; i <= N; i++) {
		a[4] = i;
		int r[5];
		r[4] = Meandian(a[0], a[1], a[2], a[3]);
		r[3] = Meandian(a[0], a[1], a[2], a[4]);
		r[2] = Meandian(a[0], a[1], a[3], a[4]);
		r[1] = Meandian(a[0], a[2], a[3], a[4]);
		r[0] = Meandian(a[1], a[2], a[3], a[4]);
		int one;
		for(int i = 0; i < 5; i++) {
			int b = 1;
			for(int j = 0; j < 5; j++) if(i != j && r[i] == r[j]) b = 0;
			if(b == 1) one = i;
		}
		ans[a[one]] = (r[0] + r[1] + r[2] + r[3] + r[4] - 3 * r[one]) / 2;
		a[one] = a[4];
	}

	Solution(ans + 1);
	return 0;
}

Compilation message

meandian.cpp: In function 'int main()':
meandian.cpp:27:10: warning: 'one' may be used uninitialized in this function [-Wmaybe-uninitialized]
   a[one] = a[4];
   ~~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 3 ms 248 KB Output is correct
7 Correct 5 ms 252 KB Output is correct
8 Correct 6 ms 248 KB Output is correct
9 Correct 6 ms 248 KB Output is correct
10 Correct 7 ms 248 KB Output is correct