답안 #486364

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
486364 2021-11-11T12:33:14 Z rainboy Ruka (COI15_ruka) C
9 / 100
2000 ms 1652 KB
#include <stdio.h>

#define N	100000

int main() {
	static int xx[N], yy[N];
	int n, m, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d%d", &xx[i], &yy[i]);
	scanf("%d", &m);
	i = 0;
	while (m--) {
		static char s[2];

		scanf("%s", s);
		if (s[0] == 'B') {
			if (i > 0)
				i--;
		} else if (s[0] == 'F') {
			if (i + 1 < n)
				i++;
		} else if (s[0] == 'C')
			scanf("%d%d", &xx[i], &yy[i]);
		else {
			int j, x, y, cnt;

			x = 1, y = 1, cnt = 0;
			for (j = 0; j < n; j++) {
				if ((x > 0) != (x + xx[j] > 0))
					cnt++;
				if ((y > 0) != (y + yy[j] > 0))
					cnt++;
				x += xx[j], y += yy[j];
			}
			printf("%d\n", cnt);
		}
	}
	return 0;
}

Compilation message

ruka.c: In function 'main':
ruka.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
ruka.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d%d", &xx[i], &yy[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ruka.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &m);
      |  ^~~~~~~~~~~~~~~
ruka.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%s", s);
      |   ^~~~~~~~~~~~~~
ruka.c:25:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |    scanf("%d%d", &xx[i], &yy[i]);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Execution timed out 2058 ms 1652 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Execution timed out 2058 ms 1652 KB Time limit exceeded
6 Halted 0 ms 0 KB -