#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 main(){
lalala;
int n,k;cin>>n>>k;
int cnt=0;
ll int arr[n];
map<ll int,int> mp;
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++){
int cev=0;
for(int j=0;j<n;j++){
if(i==j)continue;
if(arr[i]%arr[j]==k)cev++;
}cout<<cev<<" ";
}
/*for(int i=0;i<n;i++){
if(arr[i]<k){cout<<"0 ";continue;}
if(arr[i]==k){cout<<cnt<<" ";continue;}
ll int uwu=arr[i]-k;
int cev=0;
//cout<<arr[i]<<" "<<uwu<<endl;
for(int j=1;j<=sqrt(arr[i]);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];
}cout<<cev<<" ";
}*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
468 KB |
Output is correct |
2 |
Correct |
22 ms |
328 KB |
Output is correct |
3 |
Execution timed out |
2062 ms |
1440 KB |
Time limit exceeded |
4 |
Execution timed out |
2062 ms |
2952 KB |
Time limit exceeded |
5 |
Execution timed out |
2083 ms |
7560 KB |
Time limit exceeded |
6 |
Execution timed out |
2025 ms |
8636 KB |
Time limit exceeded |
7 |
Execution timed out |
2059 ms |
7472 KB |
Time limit exceeded |
8 |
Execution timed out |
2059 ms |
7476 KB |
Time limit exceeded |
9 |
Execution timed out |
2051 ms |
8524 KB |
Time limit exceeded |
10 |
Execution timed out |
2051 ms |
8524 KB |
Time limit exceeded |