답안 #481402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
481402 2021-10-20T16:32:45 Z rainboy Spiderman (COCI20_spiderman) C
70 / 70
89 ms 10176 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; b <= A; b += a)
			ans[b] += kk[a];
	for (i = 0; i < n; i++)
		printf("%d ", ans[aa[i]] - (r == 0 ? 1 : 0));
	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 18 ms 5628 KB Output is correct
3 Correct 36 ms 7200 KB Output is correct
4 Correct 71 ms 8620 KB Output is correct
5 Correct 38 ms 8608 KB Output is correct
6 Correct 89 ms 10176 KB Output is correct
7 Correct 51 ms 8600 KB Output is correct
8 Correct 37 ms 8608 KB Output is correct
9 Correct 75 ms 10016 KB Output is correct
10 Correct 80 ms 10044 KB Output is correct