Submission #844308

# Submission time Handle Problem Language Result Execution time Memory
844308 2023-09-05T12:13:19 Z vjudge1 Spiderman (COCI20_spiderman) C++17
70 / 70
155 ms 10576 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  map<int, int> cnt;
  for (int i = 0;i < N; ++i) {
    cin >> h[i];
    cnt[h[i]] += 1;
  }
  int MAX_H = 1e6 + 37;
  vector<int> div_cnt(MAX_H);
  for (auto [i, num] : cnt) {
    if (i <= K) {
      continue;
    }
    for (int j = 0;i * j < MAX_H; ++j) {
      div_cnt[i * j] += num;
    } 
  }
  for (int i = 0;i < N; ++i) {
    if (h[i] - K < 0) {
      cout << 0 << ' ';
      continue;
    }
    cout << (div_cnt[h[i] - K] - (K == 0)) << ' ';
  }
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4444 KB Output is correct
2 Correct 5 ms 4416 KB Output is correct
3 Correct 34 ms 5100 KB Output is correct
4 Correct 91 ms 6552 KB Output is correct
5 Correct 69 ms 9552 KB Output is correct
6 Correct 151 ms 10576 KB Output is correct
7 Correct 60 ms 9444 KB Output is correct
8 Correct 61 ms 9552 KB Output is correct
9 Correct 155 ms 10372 KB Output is correct
10 Correct 148 ms 10324 KB Output is correct