Submission #1092749

#TimeUsernameProblemLanguageResultExecution timeMemory
1092749Hacv16Spiderman (COCI20_spiderman)C++17
70 / 70
62 ms19276 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int const int MAX = 1e6 + 10; int n, k, v[MAX]; int resp[MAX], freq[MAX]; int32_t main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for(int i = 1; i <= n; i++) { cin >> v[i]; freq[ v[i] ]++; } for(int i = 1; i < MAX; i++) for(int j = 0; j * i + k < MAX; j++) if(k < i) resp[j * i + k] += freq[i]; for(int i = 1; i <= n; i++) cout << resp[ v[i] ] + (k == 0 ? -1 : 0) << ' '; cout << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...