제출 #500258

#제출 시각아이디문제언어결과실행 시간메모리
500258MounirSpiderman (COCI20_spiderman)C++14
56 / 70
255 ms16940 KiB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define x first
#define y second
#define int long long
using namespace std;

const int N = 1e6 + 1;
int nDiv[N];

signed main(){
      int nVals, k; cin >> nVals >> k;
      vector<int> vals(nVals);
      map<int, int> occs;
      for (int& val : vals){
            cin >> val;
            if (val > k)
                  occs[val]++;
      }

      for (auto paire : occs){
            int val = paire.first, nOccs = paire.second;
            for (int j = 0; j < N; j += val)
                  nDiv[j] += nOccs;
      }

      for (int val : vals){
            if (val < k)
                  cout << 0 << " ";
            else
                  cout << nDiv[val - k] << " ";
      }
      cout << endl;
      return 0;   
}
#Verdict Execution timeMemoryGrader output
Fetching results...