# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092749 | Hacv16 | Spiderman (COCI20_spiderman) | C++17 | 62 ms | 19276 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |