Submission #638253

# Submission time Handle Problem Language Result Execution time Memory
638253 2022-09-05T06:21:36 Z Register Spiderman (COCI20_spiderman) C++14
70 / 70
89 ms 10840 KB
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,k,h[N],b[N],s[N];
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&h[i]),b[h[i]]++;
	for(int i=k+1;i<N;i++) for(int j=k;j<N;j+=i) s[j]+=b[i];
	if(!k) for(int i=0;i<N;i++) s[i]--;
	for(int i=1;i<=n;i++) printf("%d ",s[h[i]]);
	return 0;
}

Compilation message

spiderman.cpp: In function 'int main()':
spiderman.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d%d",&n,&k);
      |  ~~~~~^~~~~~~~~~~~~~
spiderman.cpp:7:29: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  for(int i=1;i<=n;i++) scanf("%d",&h[i]),b[h[i]]++;
      |                        ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 19 ms 6484 KB Output is correct
2 Correct 22 ms 5568 KB Output is correct
3 Correct 40 ms 7904 KB Output is correct
4 Correct 68 ms 9336 KB Output is correct
5 Correct 42 ms 9292 KB Output is correct
6 Correct 89 ms 10840 KB Output is correct
7 Correct 35 ms 9288 KB Output is correct
8 Correct 39 ms 9292 KB Output is correct
9 Correct 84 ms 10692 KB Output is correct
10 Correct 79 ms 10708 KB Output is correct