제출 #1321305

#제출 시각아이디문제언어결과실행 시간메모리
1321305nathako9nSpiderman (COCI20_spiderman)C++20
21 / 70
2084 ms9068 KiB
#include <bits/stdc++.h> #define ll long long #define endl '\n' #define f first #define s second #define tii tuple<int,int> #define time timee using namespace std; const int N = 300005; map<ll,ll>mp; ll ar[N+3],n,k; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>k; int ans=0; for(int i=1;i<=n;i++){ cin>>ar[i]; if(ar[i]<=k)--ans; mp[ar[i]]=0; } for(int i=k+1;i<=1e6;i++){ if(!mp.count(i))continue; for(int j=i;j<=1e6+5;j+=i){ if(j+k<=1e6)if(mp.count(j+k))++mp[j+k]; } } for(int i=1;i<=n;i++){ if(ar[i]==k)cout<<ans+n<<" "; else cout<<mp[ar[i]]<<" "; } return 0; } /* 5 1 1 3 5 7 2 6 3 4 3 12 6 8 2 */
#Verdict Execution timeMemoryGrader output
Fetching results...