제출 #844262

#제출 시각아이디문제언어결과실행 시간메모리
844262vjudge1Spiderman (COCI20_spiderman)C++17
0 / 70
280 ms54212 KiB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
const int MAXN = 1e6 + 5;

#ifndef ONLINE_JUDGE
    #define OPEN freopen(".in", "r", stdin); \
                 freopen(".out", "w", stdout);
#else
    #define OPEN void(23);
#endif

int sieve[MAXN];
int cnts[MAXN];

void solve()
{
    int n, k; cin >> n >> k;
    vector <int> vec(n);
    for(int &i : vec) cin >> i, cnts[i]++;

    for(int i = k +1; i < MAXN; i++)
    {
        for(int j = 0; j + k < MAXN; j += i)
            sieve[j + k] += cnts[i];
    }

    for(int &i : vec) cout << sieve[i] << " ";

    return;
}

int32_t main()
{
    OPEN;

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int t = 1; //cin >> t;
    while(t--)
    {
        solve();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

spiderman.cpp: In function 'int32_t main()':
spiderman.cpp:10:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     #define OPEN freopen(".in", "r", stdin); \
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~
spiderman.cpp:38:5: note: in expansion of macro 'OPEN'
   38 |     OPEN;
      |     ^~~~
spiderman.cpp:11:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |                  freopen(".out", "w", stdout);
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
spiderman.cpp:38:5: note: in expansion of macro 'OPEN'
   38 |     OPEN;
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...