Submission #199507

#TimeUsernameProblemLanguageResultExecution timeMemory
199507SamAndSpiderman (COCI20_spiderman)C++17
70 / 70
130 ms10232 KiB
#include <bits/stdc++.h> using namespace std; const int N = 300005, M = 1000006; int n, k; int a[N]; int q[M]; int qq[M]; int main() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); q[a[i]]++; } for (int i = 1; i < M; ++i) { if (i <= k) continue; for (int j = 0; j < M; j += i) qq[j] += q[i]; } for (int i = 1; i <= n; ++i) { if (a[i] - k < 0) printf("0 "); else { if (a[i] % a[i] == k) printf("%d ", qq[a[i] - k] - 1); else printf("%d ", qq[a[i] - k]); } } printf("\n"); return 0; }

Compilation message (stderr)

spiderman.cpp: In function 'int main()':
spiderman.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &k);
     ~~~~~^~~~~~~~~~~~~~~~
spiderman.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...