답안 #481401

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
481401 2021-10-20T16:32:13 Z rainboy Spiderman (COCI20_spiderman) C
63 / 70
83 ms 10052 KB
#include <stdio.h>

#define N	300000
#define A	1000000

int main() {
	static int aa[N], kk[A + 1], ans[A + 1];
	int n, r, i, a, b;

	scanf("%d%d", &n, &r);
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]);
		kk[aa[i]]++;
	}
	for (a = r + 1; a <= A; a++)
		for (b = r == 0 ? a * 2 : r; b <= A; b += a)
			ans[b] += kk[a];
	for (i = 0; i < n; i++)
		printf("%d ", ans[aa[i]]);
	printf("\n");
	return 0;
}

Compilation message

spiderman.c: In function 'main':
spiderman.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d", &n, &r);
      |  ^~~~~~~~~~~~~~~~~~~~~
spiderman.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 6516 KB Output is correct
2 Correct 15 ms 5652 KB Output is correct
3 Correct 35 ms 7192 KB Output is correct
4 Correct 72 ms 8564 KB Output is correct
5 Correct 35 ms 8644 KB Output is correct
6 Incorrect 83 ms 10052 KB Output isn't correct
7 Correct 35 ms 8648 KB Output is correct
8 Correct 55 ms 8676 KB Output is correct
9 Correct 80 ms 9924 KB Output is correct
10 Correct 79 ms 9924 KB Output is correct