# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
440623 | Abrar_Al_Samit | Spiderman (COCI20_spiderman) | C++17 | 141 ms | 10212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define debug(x) cerr << '[' << (#x) << "] = " << x << '\n';
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update> ;
const int maxn = 1e6 + 6;
void PlayGround() {
int n; cin >> n;
int k; cin >> k;
vector<int>freq(maxn), ans(maxn);
vector<int>h(n);
int big = 0;
for(int i=0; i<n; ++i) {
cin >> h[i];
freq[h[i]]++;
big += h[i]>k;
}
for(int i=k+1; i<maxn; ++i) {
for(int j=i; j+k<maxn; j+=i) {
ans[j+k] += freq[i] - (j+k==i);
}
}
for(int i=0; i<n; ++i) {
cout << ans[h[i]] + (h[i]==k ? big : 0) << ' ';
}
cout << '\n';
#ifndef ONLINE_JUDGE
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// #endif
PlayGround();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |