Submission #930934

# Submission time Handle Problem Language Result Execution time Memory
930934 2024-02-20T20:46:52 Z rainboy 동전 게임 (KOI15_coin) C
100 / 100
22 ms 1372 KB
#include <stdio.h>

int main() {
	int n, q;

	scanf("%d%d", &n, &q);
	while (q--) {
		int x, y;

		scanf("%d%d", &x, &y);
		if (x > y)
			printf("%d\n", y + (n - x + 1) >= x - 1 ? 1 : 0);
		else if (x < y)
			printf("%d\n", x + (n - y) >= y - 1 ? 1 : 0);
		else
			printf("1\n");
	}
	return 0;
}

Compilation message

coin.c: In function 'main':
coin.c:6:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
coin.c:10:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d", &x, &y);
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 18 ms 968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 416 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 18 ms 968 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 11 ms 688 KB Output is correct
16 Correct 15 ms 860 KB Output is correct
17 Correct 22 ms 1276 KB Output is correct
18 Correct 21 ms 1116 KB Output is correct
19 Correct 19 ms 1148 KB Output is correct
20 Correct 21 ms 1372 KB Output is correct