Submission #844343

#TimeUsernameProblemLanguageResultExecution timeMemory
844343vjudge1Holding (COCI20_holding)C++17
0 / 110
19 ms16104 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define endl "\n" #define int long long #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() const int N = 1e6 + 5; void solve() { int n,k; cin >> n >> k; int ar[n+1]; for(int i=1;i<=n;i++) cin >> ar[i]; vector<int> freq(N,0); for(int i=1;i<=n;i++) freq[ar[i]]++; vector<int> ans(N,0); for(int i=k+1;i<N;i++) for(int j=0;j<N;j+=i) ans[j+k]+=freq[i]; for(int i=1;i<=n;i++) { cout << ans[ar[i]] << " \n"[i==n]; } } int32_t main(){ cin.tie(0); ios::sync_with_stdio(0); int t=1;//cin >> t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...