Submission #1099632

# Submission time Handle Problem Language Result Execution time Memory
1099632 2024-10-11T20:43:04 Z Petrix Spiderman (COCI20_spiderman) C++17
70 / 70
105 ms 30324 KB
#include <iostream>
using namespace std;

#define int long long

int v[2000001];
int ciur[2000001];
int frv[2000001];

signed main()
{
    int n,i,j,k;
    cin>>n>>k;
    for(i=1;i<=n;i++){
        cin>>v[i];
        frv[v[i]]++;
    }
    for(i=k+1;i<=2e6;i++){
        if(frv[i]){
            for(j=0;j+k<=2e6;j+=i){
                ciur[j+k]+=frv[i];
            }
        }
    }
    for(i=1;i<=n;i++){
        if(k==0)
            cout<<ciur[v[i]]-1<<" ";
        else
            cout<<ciur[v[i]]<<" ";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 27228 KB Output is correct
2 Correct 16 ms 27224 KB Output is correct
3 Correct 38 ms 27484 KB Output is correct
4 Correct 76 ms 30324 KB Output is correct
5 Correct 54 ms 27508 KB Output is correct
6 Correct 105 ms 30036 KB Output is correct
7 Correct 46 ms 27284 KB Output is correct
8 Correct 51 ms 27472 KB Output is correct
9 Correct 98 ms 30032 KB Output is correct
10 Correct 102 ms 30032 KB Output is correct