Submission #844276

# Submission time Handle Problem Language Result Execution time Memory
844276 2023-09-05T11:58:01 Z vjudge1 Spiderman (COCI20_spiderman) C++17
56 / 70
62 ms 11740 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+37;
#define int long long


signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);


    int n, k; cin >> n >> k;
    vector<int> x(n);
    vector<int> a(N);
    int f=0;
    for(int i=0; i<n; i++){
        cin >> x[i];

        if(x[i]>k) f++;
        a[x[i]]++;
    }

    for(int l=N-1; l>k; l--){

        for(int j=l*2; j<N; j+=l){
            a[j]+=a[l];
        }

    }


    for(int i=0; i<n; i++){
        if(x[i]-k<=k&&x[i]!=k) cout<<0<<" ";
        else if(x[i]==k) cout<<f<<" ";
        else cout<<a[x[i]-k]<<" ";
    }
} 
# Verdict Execution time Memory Grader output
1 Correct 14 ms 8312 KB Output is correct
2 Correct 16 ms 8316 KB Output is correct
3 Correct 29 ms 9308 KB Output is correct
4 Correct 50 ms 11440 KB Output is correct
5 Incorrect 29 ms 9192 KB Output isn't correct
6 Incorrect 58 ms 11740 KB Output isn't correct
7 Correct 25 ms 9088 KB Output is correct
8 Correct 27 ms 9308 KB Output is correct
9 Correct 60 ms 11396 KB Output is correct
10 Correct 62 ms 11292 KB Output is correct