답안 #638254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638254 2022-09-05T06:24:04 Z colazcy Spiderman (COCI20_spiderman) C++17
0 / 70
16 ms 4256 KB
#include <cstdio>
#include <cassert>
#include <algorithm>
#define let const auto
#define rep(name,beg,end) for(auto lim_##name = end,name = beg;name <= lim_##name;name++)
#define per(name,beg,end) for(auto lim_##name = end,name = beg;name >= lim_##name;name--)
#define repn(lim) for(auto REPN_lIM = lim,REPN = 1;REPN <= REPN_lIM;REPN++)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define trace() debug("line : %d, Function : %s\n",__LINE__,__FUNCTION__)
using ll = long long;
constexpr int maxn = 3e5 + 100,maxm = 1e6 + 100;

int n,k,val[maxn];
int f[maxm],ans[maxm];
int main(){
#ifndef ONLINE_JUDGE
    std::freopen("fufu.in","r",stdin);
#endif
    std::scanf("%d %d",&n,&k);
    rep(i,1,n)
        std::scanf("%d",val + i),
        f[val[i]]++;
    rep(i,k + 1,maxm - 1)
        for(int r = k;r < maxm;r += i)
            ans[r] += f[i];
    rep(i,1,n)
        if(val[i] < k)std::printf("%d ",0);
        else std::printf("%d ",ans[val[i]]);
    return 0;
}

Compilation message

spiderman.cpp: In function 'int main()':
spiderman.cpp:17:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     std::freopen("fufu.in","r",stdin);
      |     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
spiderman.cpp:19:15: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     std::scanf("%d %d",&n,&k);
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~
spiderman.cpp:21:19: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         std::scanf("%d",val + i),
      |         ~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 4180 KB Output isn't correct
2 Incorrect 16 ms 4196 KB Output isn't correct
3 Incorrect 16 ms 4256 KB Output isn't correct
4 Incorrect 14 ms 4200 KB Output isn't correct
5 Incorrect 15 ms 4196 KB Output isn't correct
6 Incorrect 15 ms 4180 KB Output isn't correct
7 Incorrect 16 ms 4192 KB Output isn't correct
8 Incorrect 15 ms 4180 KB Output isn't correct
9 Incorrect 15 ms 4196 KB Output isn't correct
10 Incorrect 15 ms 4180 KB Output isn't correct