제출 #340604

#제출 시각아이디문제언어결과실행 시간메모리
340604A_DSpiderman (COCI20_spiderman)C++14
70 / 70
184 ms12268 KiB
/*
ID: antwand1
TASK: barn1
LANG: C++
*/
#include <bits/stdc++.h>
#define ll long long
#define du long double
#define F first
#define S second
using namespace std;
const int N=1e6+100;
int a[N];
int ar[N];
int ans[N];
main()
{
    //freopen("barn1.in","r",stdin);freopen("barn1.out","w",stdout);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        int b;
        cin>>b;
        ar[i]=b;
        a[b]++;
    }
    for(int i=1;i<=1e6;i++){
        if(a[i]&&k<=i-1){
            for(int j=0;j*i<=1e6;j++){
//                cout<<i<<" "<<j<<"\n";
                ans[j*i+k]+=a[i];
            }
        }
    }
  //  cout<<endl;
    if(k==0){
        for(int i=1;i<=1e6;i++)ans[i]--;
    }
    //for(int i=1;i<=12;i++)cout<<ans[i]<<" ";cout<<endl;
    for(int i=1;i<=n;i++){
        cout<<ans[ar[i]]<<" ";
    }
    //cout<<endl;
}




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

spiderman.cpp:16:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main()
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...