# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
258420 | 2020-08-05T22:58:05 Z | ipaljak | Spiderman (COCI20_spiderman) | C++14 | 248 ms | 12536 KB |
#include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << typedef long long llint; const int MAXN = 3e5 + 10; const int MAXH = 1e6 + 10; int n, k; int h[MAXN], sol[MAXH]; map<int, int> cnt; int main(void) { scanf("%d%d", &n, &k); for (int i = 0; i < n; ++i) { scanf("%d", &h[i]); cnt[h[i]]++; } for (const auto &p : cnt) { if (p.first <= k) continue; for (int j = k; j < MAXH; j += p.first) sol[j] += p.second; if (k == 0) sol[p.first]--; } for (int i = 0; i < n; ++i) printf("%d ", sol[h[i]]); printf("\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 4352 KB | Output is correct |
2 | Correct | 16 ms | 4352 KB | Output is correct |
3 | Correct | 54 ms | 5624 KB | Output is correct |
4 | Correct | 110 ms | 8312 KB | Output is correct |
5 | Correct | 130 ms | 10232 KB | Output is correct |
6 | Correct | 218 ms | 12408 KB | Output is correct |
7 | Correct | 107 ms | 10232 KB | Output is correct |
8 | Correct | 108 ms | 10232 KB | Output is correct |
9 | Correct | 213 ms | 12408 KB | Output is correct |
10 | Correct | 248 ms | 12536 KB | Output is correct |