Submission #844280

# Submission time Handle Problem Language Result Execution time Memory
844280 2023-09-05T11:59:23 Z vjudge1 Spiderman (COCI20_spiderman) C++17
56 / 70
98 ms 18196 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
//#define int long long
#define pii pair<int,int>
#define bg begin
#define vi vector<int>
#define vvi vector<vi> 
#define vp vector<pii>
#define ppi pair<pii,int>
#define endl '\n'
#define triple tuple<int,int,int>
#define ppp pair<pii,pii>
#define pip pair<int,pii>
#define vpp vector<ppi>
#define sp << " " << 
#define ff first
#define ss second
#define F(xxx,n) for (int xxx=1;xxx<=n;++xxx)
#define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx)
#define pb push_back
const int MOD = 1e9+7;

void solve() {
    int n,k;
    cin >> n >> k;
    vi a(n+1);
    F(i,n) cin >> a[i];
    vi cnt(2e6+1,0);
    F(i,n) cnt[a[i]]++;
    vi cur(2e6+1,0);
    for (int i=k+1;i<=2000000;i++) {
        for (int j=k;j<=2000000;j+=i) cur[j]+=cnt[i];
    }
    for (int i=1;i<=n;i++) {
        cout << cur[a[i]] << " ";
    }
    cout << endl;
}  
 
 
 
signed main() { 
    #ifdef Local
        freopen("input.in","r",stdin);
        freopen("input.out","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);cin.tie(0);    
    int t = 1;
    //cin >> t;
    while (t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 34 ms 16216 KB Output is correct
2 Correct 31 ms 15964 KB Output is correct
3 Correct 43 ms 16724 KB Output is correct
4 Correct 67 ms 18196 KB Output is correct
5 Incorrect 62 ms 16724 KB Output isn't correct
6 Incorrect 98 ms 18000 KB Output isn't correct
7 Correct 53 ms 16508 KB Output is correct
8 Correct 52 ms 16516 KB Output is correct
9 Correct 81 ms 18052 KB Output is correct
10 Correct 67 ms 18004 KB Output is correct