제출 #1321149

#제출 시각아이디문제언어결과실행 시간메모리
1321149nathako9nSpiderman (COCI20_spiderman)C++20
0 / 70
2096 ms8324 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;
        if(ar[i]!=k)mp[ar[i]]=0;
    }
    for(int i=1;i<=n;i++){
        if(ar[i]==k)continue;
        for(int j=k;j<=1e6+5;j+=ar[i]){
            if(mp.count(j))++mp[j];
        }
    }
    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...