Submission #643887

# Submission time Handle Problem Language Result Execution time Memory
643887 2022-09-23T07:55:26 Z MuntherCarrot Spiderman (COCI20_spiderman) C++14
70 / 70
540 ms 6312 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define endl "\n"
#define all(x) x.begin(),x.end()
const int MOD = 0, SZ = 1e4+5e3, MX = 1e6+1;
void solve(){
    int n, k;
    cin >> n >> k;
    int arr[n];
    vector<int> vec(MX, 0);
    for(int &i : arr)
        cin >> i;
    for(int i : arr){
        if(i <= k) continue;
        for(int j=k;j<MX;j+=i){
            vec[j]++;
        }
    }
    for(int i : arr)
        cout << (k ? vec[i] : vec[i]-1) << ' ';
}
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    int test;
//    cin >> test;
//    while(test--)
       solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4180 KB Output is correct
2 Correct 9 ms 4180 KB Output is correct
3 Correct 309 ms 4876 KB Output is correct
4 Correct 540 ms 6296 KB Output is correct
5 Correct 33 ms 4820 KB Output is correct
6 Correct 78 ms 6312 KB Output is correct
7 Correct 23 ms 4788 KB Output is correct
8 Correct 25 ms 4808 KB Output is correct
9 Correct 76 ms 6164 KB Output is correct
10 Correct 84 ms 6032 KB Output is correct