| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1370446 | FaresSTH | Spiderman (COCI20_spiderman) | C++20 | 290 ms | 6272 KiB |
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
#define S second
#define F first
int f[1000001];
int main(){
cin.tie(0)->sync_with_stdio(0);
int n,k;
cin>>n>>k;
int a[n],ans=0;
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]>k)ans++;
f[a[i]]++;
}
for(int i=0;i<n;i++){
int cnt=0;
if(a[i]>k){
f[a[i]]--;
for(int j=1;j*j<=a[i]-k;j++){
if((a[i]-k)%j)continue;
if(j>k)cnt+=f[j];
if(j*j!=a[i]-k&&(a[i]-k)/j>k)cnt+=f[(a[i]-k)/j];
}
f[a[i]]++;
}
else if(a[i]==k)cnt=ans;
cout<<cnt<<' ';
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
