結果

問題 No.1110 好きな歌
ユーザー erbowlerbowl
提出日時 2020-07-10 21:44:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 923 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 2,406 ms
コンパイル使用メモリ 212,316 KB
実行使用メモリ 42,208 KB
最終ジャッジ日時 2023-08-01 17:20:43
合計ジャッジ時間 23,177 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 4 ms
4,380 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 462 ms
26,348 KB
testcase_25 AC 565 ms
31,084 KB
testcase_26 AC 272 ms
17,516 KB
testcase_27 AC 574 ms
30,800 KB
testcase_28 AC 302 ms
19,172 KB
testcase_29 AC 674 ms
35,220 KB
testcase_30 AC 302 ms
19,164 KB
testcase_31 AC 171 ms
12,816 KB
testcase_32 AC 773 ms
38,972 KB
testcase_33 AC 352 ms
21,888 KB
testcase_34 AC 501 ms
28,176 KB
testcase_35 AC 827 ms
42,116 KB
testcase_36 AC 69 ms
7,676 KB
testcase_37 AC 190 ms
13,864 KB
testcase_38 AC 648 ms
34,672 KB
testcase_39 AC 473 ms
26,804 KB
testcase_40 AC 630 ms
33,868 KB
testcase_41 AC 37 ms
5,632 KB
testcase_42 AC 724 ms
38,148 KB
testcase_43 AC 674 ms
34,984 KB
testcase_44 AC 822 ms
42,112 KB
testcase_45 AC 827 ms
42,208 KB
testcase_46 AC 840 ms
42,136 KB
testcase_47 AC 923 ms
42,128 KB
testcase_48 AC 830 ms
42,136 KB
testcase_49 AC 831 ms
42,072 KB
testcase_50 AC 826 ms
42,116 KB
testcase_51 AC 834 ms
42,168 KB
testcase_52 AC 817 ms
42,052 KB
testcase_53 AC 823 ms
42,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n,d;
    std::cin >> n>>d;
    vector<ll> a(n);
    map<ll,ll> vi,iv;
    
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        vi[a[i]] = i;
        iv[i] = a[i];
    }
    sort(a.begin(),a.end());
    map<ll,ll> ans;
    for (int i = 0; i < n; i++) {
        ans[a[i]] = distance(a.begin(),upper_bound(a.begin(),a.end(),a[i]-d));
    }
    for (int i = 0; i < n; i++) {
        std::cout << ans[iv[i]] << std::endl;
    }
}
0