답안 #198227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198227 2020-01-25T07:25:52 Z alrad Spiderman (COCI20_spiderman) C++17
49 / 70
2000 ms 57680 KB
#include <bits/stdc++.h>

using namespace std;

const int LIMIT = 1e6 + 5;

int main() {
   ios_base :: sync_with_stdio(0);
   cin.tie(0) , cout.tie(0);
   int n , k;
   cin >> n >> k;
   vector<int> a(n);
   unordered_map<int , int> tot;
   unordered_map<int , int> ans;
   for (int i = 0; i < n; i++) {
      cin >> a[i];
      tot[a[i]]++;
   }
   for (auto e : tot) {
      int num = e.first;
      int counter = e.second;
      if (num <= k) {
         continue;
      }
      for (int j = k; j < LIMIT; j += num) {
         ans[j] += counter;
      }
      if (k == 0) {
         ans[num]--;
      }
   }
   for (int i = 0; i < n; i++) {
      cout << ans[a[i]] << " ";
   }
   return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 547 ms 25792 KB Output is correct
2 Correct 630 ms 30268 KB Output is correct
3 Correct 986 ms 36960 KB Output is correct
4 Correct 849 ms 35008 KB Output is correct
5 Execution timed out 2067 ms 55152 KB Time limit exceeded
6 Execution timed out 2033 ms 56944 KB Time limit exceeded
7 Correct 1505 ms 35696 KB Output is correct
8 Correct 1790 ms 37940 KB Output is correct
9 Execution timed out 2060 ms 57680 KB Time limit exceeded
10 Correct 1942 ms 41168 KB Output is correct