제출 #1239871

#제출 시각아이디문제언어결과실행 시간메모리
1239871PlayVoltzSpiderman (COCI20_spiderman)C++20
70 / 70
66 ms19268 KiB
#include <cstdio> #include <stdio.h> #include <stdbool.h> #include <iostream> #include <map> #include <vector> #include <climits> #include <stack> #include <string> #include <queue> #include <algorithm> #include <set> #include <unordered_set> #include <unordered_map> #include <cmath> #include <cctype> #include <bitset> #include <iomanip> #include <cstring> #include <numeric> #include <cassert> #include <random> #include <chrono> #include <fstream> using namespace std; #define int long long #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin>>n>>k; vector<int> c(1000005, 0), ans(1000005, 0), vect(n); for (int i=0; i<n; ++i)cin>>vect[i], ++c[vect[i]]; c[0]=n; for (int i=k+1; i<=1000000; ++i)for (int j=0; j<=1000000; j+=i)ans[j]+=c[i]; for (int i=0; i<n; ++i){ if (vect[i]<k)cout<<"0 "; else cout<<ans[vect[i]-k]-!k<<" "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...