結果

問題 No.1110 好きな歌
ユーザー syomu
提出日時 2020-07-10 22:29:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,068 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 168,204 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-11 09:47:06
合計ジャッジ時間 12,962 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 RE * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ

//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;

//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

//#include "./lib/generic/search.h"

int main(){
    int n, d;
    cin >> n >> d;
    int a[n], amax=0;
    rep(i, n){
        cin >> a[i];
        amax = max(amax, a[i]);
    }
    int b[amax], ans[amax];
    rep(i, n){
        b[i] = 0;
        ans[i] = 0;
    }
    int cnt = 0;
    rep(i, n){
        cnt = 0;
        if(b[a[i]]==1){
            cout << ans[a[i]] << endl;
        }
        else{
            rep(j, n){
                //if(a[i]<a[j]) break;
                if(i!=j && a[i]-a[j]>=d) cnt++;
            }
            b[a[i]] = 1; 
            ans[a[i]] = cnt;
            cout << cnt << endl;
        }
    }
    return 0;
}
0