Submission #500261

# Submission time Handle Problem Language Result Execution time Memory
500261 2021-12-30T14:36:29 Z Mounir Spiderman (COCI20_spiderman) C++14
14 / 70
415 ms 24800 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 = 2e6 + 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;
                  if (j == val)
                        nDiv[j]--;
            }
      }

      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 Incorrect 37 ms 16084 KB Output isn't correct
2 Incorrect 55 ms 16012 KB Output isn't correct
3 Incorrect 100 ms 17172 KB Output isn't correct
4 Incorrect 170 ms 19464 KB Output isn't correct
5 Correct 224 ms 23224 KB Output is correct
6 Correct 415 ms 24800 KB Output is correct
7 Incorrect 183 ms 23176 KB Output isn't correct
8 Incorrect 192 ms 23176 KB Output isn't correct
9 Incorrect 309 ms 24772 KB Output isn't correct
10 Incorrect 311 ms 24604 KB Output isn't correct