結果

問題 No.1110 好きな歌
ユーザー syomusyomu
提出日時 2020-07-10 22:25:27
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,084 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 162,944 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-19 17:36:08
合計ジャッジ時間 13,511 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 RE -
testcase_05 AC 2 ms
5,376 KB
testcase_06 RE -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
権限があれば一括ダウンロードができます

ソースコード

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(){
    ll n, d;
    cin >> n >> d;
    ll a[n], amax=0;
    rep(i, n){
        cin >> a[i];
        amax = max(amax, a[i]);
    }
    ll b[amax], ans[amax];
    //std::sort(a, a + SIZE_OF_ARRAY(a));
    //rep(i, n) cout << a[i] << " ";
    ll 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