답안 #500260

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500260 2021-12-30T14:35:06 Z Mounir Spiderman (COCI20_spiderman) C++14
56 / 70
348 ms 24936 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;
      }

      for (int val : vals){
            if (val < k)
                  cout << 0 << " ";
            else
                  cout << nDiv[val - k] << " ";
      }
      cout << endl;
      return 0;   
}
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 16076 KB Output is correct
2 Correct 46 ms 16012 KB Output is correct
3 Correct 99 ms 17180 KB Output is correct
4 Correct 158 ms 19396 KB Output is correct
5 Incorrect 223 ms 23116 KB Output isn't correct
6 Incorrect 327 ms 24936 KB Output isn't correct
7 Correct 183 ms 23092 KB Output is correct
8 Correct 180 ms 23112 KB Output is correct
9 Correct 301 ms 24708 KB Output is correct
10 Correct 348 ms 24624 KB Output is correct