結果

問題 No.1110 好きな歌
ユーザー けーむけーむ
提出日時 2020-07-20 14:13:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 928 bytes
コンパイル時間 2,349 ms
コンパイル使用メモリ 169,936 KB
実行使用メモリ 6,236 KB
最終ジャッジ日時 2023-08-25 03:45:04
合計ジャッジ時間 11,122 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 44 ms
4,788 KB
testcase_25 AC 53 ms
5,332 KB
testcase_26 AC 30 ms
4,380 KB
testcase_27 AC 53 ms
5,264 KB
testcase_28 AC 29 ms
4,384 KB
testcase_29 AC 68 ms
5,676 KB
testcase_30 AC 26 ms
4,380 KB
testcase_31 AC 18 ms
4,380 KB
testcase_32 AC 75 ms
5,940 KB
testcase_33 AC 28 ms
4,528 KB
testcase_34 AC 43 ms
5,156 KB
testcase_35 AC 61 ms
6,180 KB
testcase_36 AC 8 ms
4,376 KB
testcase_37 AC 22 ms
4,380 KB
testcase_38 AC 69 ms
5,608 KB
testcase_39 AC 49 ms
4,772 KB
testcase_40 AC 48 ms
5,300 KB
testcase_41 AC 6 ms
4,376 KB
testcase_42 AC 59 ms
5,828 KB
testcase_43 AC 66 ms
5,776 KB
testcase_44 AC 65 ms
6,156 KB
testcase_45 AC 77 ms
6,196 KB
testcase_46 AC 72 ms
6,132 KB
testcase_47 AC 86 ms
6,096 KB
testcase_48 AC 76 ms
6,104 KB
testcase_49 AC 57 ms
6,168 KB
testcase_50 AC 75 ms
6,228 KB
testcase_51 AC 68 ms
6,236 KB
testcase_52 AC 75 ms
6,180 KB
testcase_53 AC 86 ms
6,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, d;
    cin >> n >> d;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> sa(n);
    rep(i, n) sa[i] = a[i];
    sort(all(sa));
    rep(i, n) {
        ll v = a[i] - d;
        ll ans = upper_bound(all(sa), v) - sa.begin();
        if (v >= a[i]) ans--;
        cout << ans << endl;
    }
    return 0;
}
0