# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
644296 | emad234 | Spiderman (COCI20_spiderman) | C++17 | 1079 ms | 14876 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define all(v) ((v).begin(),(v).end())
using namespace std;
#define int long long
const int mod = 1e9 + 7;
const int mxN = 2e6 + 1;
int a[mxN];
int fr[mxN];
int ans[mxN];
int gr[mxN];
signed main()
{
cin.tie(0);cout.tie(0);
ios_base::sync_with_stdio(0);
int n,k;
cin >>n>>k;
int num = 0;
for(int i = 0;i < n;i++){
cin >>a[i];
if(a[i] > k)
num++;
fr[a[i]]++;
}
for(int i = 0;i < n;i++){
if(a[i] > k){
int x = a[i] - k;
for(int j = 1;j * j <= x;j++){
if(x % j == 0){
if(j > k && j){
if(j == a[i])
ans[i] += fr[j] - 1;
else
ans[i] += fr[j];
}
if(x / j > k && x/ j != j){
if(x / j == a[i])
ans[i] += fr[x / j] - 1;
else
ans[i] += fr[x / j];
}
}
}
}else if(a[i] == k){
ans[i] = num;
}
cout<<ans[i]<<' ';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |