Submission #500258

# Submission time Handle Problem Language Result Execution time Memory
500258 2021-12-30T14:33:22 Z Mounir Spiderman (COCI20_spiderman) C++14
56 / 70
255 ms 16940 KB
#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 time Memory Grader output
1 Correct 12 ms 8268 KB Output is correct
2 Correct 14 ms 8196 KB Output is correct
3 Correct 57 ms 9380 KB Output is correct
4 Correct 133 ms 11544 KB Output is correct
5 Incorrect 125 ms 15308 KB Output isn't correct
6 Incorrect 231 ms 16940 KB Output isn't correct
7 Correct 126 ms 15284 KB Output is correct
8 Correct 123 ms 15300 KB Output is correct
9 Correct 215 ms 16836 KB Output is correct
10 Correct 255 ms 16860 KB Output is correct