Submission #481400

# Submission time Handle Problem Language Result Execution time Memory
481400 2021-10-20T16:30:50 Z rainboy Spiderman (COCI20_spiderman) C
56 / 70
100 ms 12128 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]]);
	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]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 21 ms 6476 KB Output is correct
2 Correct 16 ms 5664 KB Output is correct
3 Correct 34 ms 7748 KB Output is correct
4 Correct 75 ms 10416 KB Output is correct
5 Incorrect 41 ms 9252 KB Output isn't correct
6 Incorrect 82 ms 12128 KB Output isn't correct
7 Correct 34 ms 9268 KB Output is correct
8 Correct 46 ms 9288 KB Output is correct
9 Correct 100 ms 11852 KB Output is correct
10 Correct 97 ms 11832 KB Output is correct