Submission #580919

# Submission time Handle Problem Language Result Execution time Memory
580919 2022-06-22T06:18:54 Z AGE Spiderman (COCI20_spiderman) C++14
56 / 70
202 ms 31200 KB
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define pb push_back

using namespace std;
const int N=1e6,M=2e3,mod=1e9+7;

int a[N],seive[N+10],ans[N],mp[N+10],mp2[N+10];
 main()
{
    int n,m;
    cin>>n>>m;

    for(int i=0;i<n;i++)
        cin>>a[i],mp[a[i]]++;

    for(int i=1;i<=1e6;i++)
        mp2[i]+=mp[i]+mp2[i-1];

    for(int i=1;i<=1e6;i++){

        if(i<=m)
            continue;

        for(int j=i;j<=1e6;j+=i){

            seive[j]+=mp[i];

        }

    }




    for(int i=0;i<n;i++){

        if(a[i]<m)
            continue;

        if(a[i]==m){
            ans[i]=n-mp2[a[i]];
            continue;
        }

        ans[i]=seive[a[i]-m];

    }

    for(int i=0;i<n;i++)
        cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}

Compilation message

spiderman.cpp:11:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 |  main()
      |  ^~~~
# Verdict Execution time Memory Grader output
1 Correct 64 ms 18936 KB Output is correct
2 Correct 80 ms 17720 KB Output is correct
3 Correct 119 ms 21488 KB Output is correct
4 Correct 161 ms 26332 KB Output is correct
5 Incorrect 127 ms 26356 KB Output isn't correct
6 Incorrect 186 ms 31196 KB Output isn't correct
7 Correct 89 ms 26160 KB Output is correct
8 Correct 101 ms 26188 KB Output is correct
9 Correct 186 ms 31200 KB Output is correct
10 Correct 202 ms 31068 KB Output is correct