# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256655 | MrRobot_28 | Spiderman (COCI20_spiderman) | C++17 | 97 ms | 12152 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;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
cin >> n >> k;
vector <int> cnt(1e6 + 1, 0), cnt1(1e6 + 1, 0);
vector <int> h(n);
int a = 0;
for(int i = 0; i < n; i++)
{
cin >> h[i];
if(h[i] > k)
{
a++;
cnt1[h[i]]++;
}
}
for(int j = 1; j <= 1e6; j++)
{
int k = j;
while(k <= 1e6)
{
cnt[k] += cnt1[j];
k += j;
}
}
for(int i = 0; i < n; i++)
{
if(h[i] < k)
{
cout << 0 << " ";
}
else if(h[i] == k)
{
cout << a << " ";
}
else if(k == 0)
{
cout << cnt[h[i]] - 1 << " " ;
}
else
{
cout << cnt[h[i] - k] << " ";
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |