제출 #735205

#제출 시각아이디문제언어결과실행 시간메모리
735205DangerNoodle7591Spiderman (COCI20_spiderman)C++17
70 / 70
1187 ms6432 KiB
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); //#define mod 1000000007 #define N 1000005 //#define big 1000000000000000007 int mp[N]; int main(){ lalala; int n,k;cin>>n>>k; int cnt=0; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; mp[arr[i]]++; if(arr[i]>k)cnt++; } for(int i=0;i<n;i++){ if(arr[i]<k){cout<<"0 ";continue;} if(arr[i]==k){cout<<cnt<<" ";continue;} int uwu=arr[i]-k, cev=0; //cout<<arr[i]<<" "<<uwu<<endl; for(int j=1;j<=sqrt(uwu);j++){ if(uwu%j)continue; //cout<<cev<<" "<<j<<" "<<uwu/j<<" "<<mp[j]<<" "<<mp[uwu/j]<<endl; if(arr[i]%j==k){ cev+=mp[j]; } if(j*j!=uwu && arr[i]%(uwu/j)==k)cev+=mp[uwu/j]; } if(k==0)cev--; cout<<cev<<" "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...