#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define x first
#define y second
#define int long long
using namespace std;
const int N = 1e6 + 1;
int nDiv[N];
signed main(){
int nVals, k; cin >> nVals >> k;
vector<int> vals(nVals);
map<int, int> occs;
for (int& val : vals){
cin >> val;
if (val > k)
occs[val]++;
}
for (auto paire : occs){
int val = paire.first, nOccs = paire.second;
for (int j = val; j < N; j += val)
nDiv[j] += nOccs;
}
for (int val : vals){
if (val < k)
cout << 0 << " ";
else if (val == k)
cout << nVals - 1 << " ";
else
cout << nDiv[val - k] << " ";
}
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
8244 KB |
Output isn't correct |
2 |
Incorrect |
15 ms |
8112 KB |
Output isn't correct |
3 |
Incorrect |
59 ms |
9928 KB |
Output isn't correct |
4 |
Incorrect |
129 ms |
13440 KB |
Output isn't correct |
5 |
Incorrect |
121 ms |
16028 KB |
Output isn't correct |
6 |
Incorrect |
221 ms |
18900 KB |
Output isn't correct |
7 |
Incorrect |
113 ms |
15996 KB |
Output isn't correct |
8 |
Incorrect |
119 ms |
15960 KB |
Output isn't correct |
9 |
Incorrect |
216 ms |
18740 KB |
Output isn't correct |
10 |
Incorrect |
221 ms |
18724 KB |
Output isn't correct |