Submission #1017193

# Submission time Handle Problem Language Result Execution time Memory
1017193 2024-07-09T05:53:24 Z vjudge1 Spiderman (COCI20_spiderman) C++17
70 / 70
97 ms 10144 KB
#include<bits/stdc++.h>

using namespace std;

const int N = 1e6 + 2;
int cnt[N], ans[N];

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for(int i = 0; i < n; i ++)
    {
      cin >> v[i];
      cnt[v[i]]++;
    }

  for(int i = k + 1; i < N; i++)
    for(int j = k; j < N; j += i)
      ans[j] += cnt[i];
  
  for(int x : v)
    {
      cout << ans[x] - (k == 0) << ' ';
    }
  cout << endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 15 ms 6640 KB Output is correct
2 Correct 16 ms 5724 KB Output is correct
3 Correct 37 ms 7268 KB Output is correct
4 Correct 97 ms 8788 KB Output is correct
5 Correct 39 ms 8784 KB Output is correct
6 Correct 85 ms 10140 KB Output is correct
7 Correct 35 ms 8808 KB Output is correct
8 Correct 39 ms 8788 KB Output is correct
9 Correct 85 ms 10144 KB Output is correct
10 Correct 82 ms 10068 KB Output is correct