| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1370456 | FaresSTH | Spiderman (COCI20_spiderman) | C++20 | 29 ms | 6024 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<=k;j++){
if((a[i]-k)%j)continue;
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<<' ';
}
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
