답안 #844374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844374 2023-09-05T12:47:32 Z vjudge1 Spiderman (COCI20_spiderman) C++17
0 / 70
404 ms 23380 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
const int N = 1e6 + 5, MOD = 1e9 + 7;

ll cnt[N], ans[N];
map<ll, ll> mp;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, k, a = 0;
    cin >> n >> k;
    
    vector<int> vec(n);

    for(int i = 0; i < n; i++)
    {
        cin >> vec[i];
        cnt[vec[i]]++;

        if(vec[i] > k)
            a++;
    }    

    ans[0] = a;

    for(ll i = 0; i < n; i++)
    {
        ll x = vec[i] - k;
        if(x > 0 and !mp[x])
        {
            mp[x] = true;
            for(ll j = 1; j * j <= x; j++)
            {
                if(x % j == 0)
                {
                    ans[x] = (j <= k ? 0 : cnt[j]);
                    if(x / j != j)
                        ans[x] += (x / j <= k ? 0 : cnt[x / j]);
                }
            }
        }
    }

    for(int i = 0; i < n; i++)
    {
        if(vec[i] < k)
            cout << 0 << " ";
        else
            cout << ans[vec[i] - k] << " ";
    }

    cout << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 15448 KB Output isn't correct
2 Incorrect 5 ms 15192 KB Output isn't correct
3 Incorrect 26 ms 15956 KB Output isn't correct
4 Incorrect 57 ms 17228 KB Output isn't correct
5 Incorrect 349 ms 22868 KB Output isn't correct
6 Incorrect 360 ms 23380 KB Output isn't correct
7 Incorrect 390 ms 22812 KB Output isn't correct
8 Incorrect 393 ms 22932 KB Output isn't correct
9 Incorrect 404 ms 23376 KB Output isn't correct
10 Incorrect 402 ms 23376 KB Output isn't correct