답안 #545131

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
545131 2022-04-03T16:16:11 Z rainboy 보물 찾기 (CEOI13_treasure2) C
컴파일 오류
0 ms 0 KB
#include <stdio.h>

#define N	100

int query(int i1, int j1, int i2, int j2) {
	int x;

	if (i1 > i2 || j1 > j2)
		return 0;
	printf("%d %d %d %d\n", i1 + 1, j1 + 1, i2 + 1, j2 + 1), fflush(stdout);
	scanf("%d", &x);
	return x;
}

int main() {
	static int aa[N][N];
	int n, i, j;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++) {
			int i1, i2, j1, j2;

			if (i + 1 >= n - 1 - i)
				i1 = 0, i2 = i;
			else
				i1 = i + 1, i2 = n - 1;
			if (j + 1 >= n - 1 - j)
				j1 = 0, j2 = j;
			else
				j1 = j + 1, j2 = n - 1;
			aa[i][j] = query(i1, j1, i2, j2);
		}
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			if (i + 1 < n - 1 - i && j + 1 < n - 1 - j)
				aa[i][j] = aa[n - 1][n - 1] - aa[n - 1][j] - aa[i][n - 1] + aa[i][j];
			else if (i + 1 < n - 1 - i)
				aa[i][j] = aa[n - 1][j] - aa[i][j];
			else if (j + 1 < n - 1 - j)
				aa[i][j] = aa[i][n - 1] - aa[i][j];
	for (i = 0; i < n; i++)
		for (j = n - 1; j > 0; j--)
			aa[i][j] -= aa[i][j - 1];
	for (j = 0; j < n; j++)
		for (i = n - 1; i > 0; i--)
			aa[i][j] -= aa[i - 1][j];
	printf("END\n");
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++)
			printf("%d", aa[i][j]);
		printf("\n");
	}
	fflush(stdout);
	return 0;
}

Compilation message

grader.c: In function 'main':
grader.c:63:19: error: expected expression before 'int'
   63 |         my_assert(int(strlen(A[i]+1)) == N, "each line of the map must contain N zeroes or ones (before loop)");
      |                   ^~~
grader.c:63:9: error: too few arguments to function 'my_assert'
   63 |         my_assert(int(strlen(A[i]+1)) == N, "each line of the map must contain N zeroes or ones (before loop)");
      |         ^~~~~~~~~
grader.c:18:6: note: declared here
   18 | void my_assert (int a, const char* s) {
      |      ^~~~~~~~~
treasure.c: In function 'query':
treasure.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &x);
      |  ^~~~~~~~~~~~~~~
treasure.c: In function 'main':
treasure.c:19:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~