# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
881342 | ilhan_arda | Spiderman (COCI20_spiderman) | C++17 | 1014 ms | 7888 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fi first
#define se second
#define pb push_back
#define endl "\n"
//~ #define int long long
using namespace std;
typedef tuple<int, int, int> iii;
typedef long long ll;
const int mod =998244353;
int n, k;
int a[300005], mp[1000005];
int32_t main(){
fast;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
mp[a[i]]++;
}
//~ sort(a+1, a+n+1);
int temp=-1;
for(int i=1;i<=n;i++){
if(a[i]<k){
cout<<0<<" ";
continue;
}
if(a[i]==k && temp==-1){
temp=n;
for(int j=1;j<=n;j++){
if(a[j]<=k)temp--;
}
cout<<temp<<" ";
continue;
}
else if(a[i]==k){
cout<<temp<<" ";
continue;
}
int ans=0;
a[i]-=k;
for(int j=1;j*j<=a[i];j++){
if(a[i]/j*j==a[i]){
if(j>k)ans+=mp[j];
if(j*j!=a[i] && a[i]/j>k)ans+=mp[a[i]/j];
if(j==1 && k==0){
ans--;
}
}
}
a[i]+=k;
cout<<ans<<" ";
}
cout<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |