結果

問題 No.1110 好きな歌
ユーザー erbowlerbowl
提出日時 2020-07-10 21:44:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 803 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 2,219 ms
コンパイル使用メモリ 209,044 KB
実行使用メモリ 42,368 KB
最終ジャッジ日時 2024-04-19 16:33:46
合計ジャッジ時間 20,878 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
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 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 4 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 427 ms
26,368 KB
testcase_25 AC 527 ms
31,360 KB
testcase_26 AC 253 ms
17,664 KB
testcase_27 AC 530 ms
30,848 KB
testcase_28 AC 282 ms
19,328 KB
testcase_29 AC 619 ms
35,328 KB
testcase_30 AC 270 ms
19,328 KB
testcase_31 AC 161 ms
13,056 KB
testcase_32 AC 700 ms
39,040 KB
testcase_33 AC 325 ms
21,888 KB
testcase_34 AC 468 ms
28,288 KB
testcase_35 AC 747 ms
42,240 KB
testcase_36 AC 62 ms
7,680 KB
testcase_37 AC 176 ms
13,972 KB
testcase_38 AC 608 ms
34,944 KB
testcase_39 AC 445 ms
27,008 KB
testcase_40 AC 585 ms
34,048 KB
testcase_41 AC 35 ms
5,760 KB
testcase_42 AC 666 ms
38,272 KB
testcase_43 AC 587 ms
35,072 KB
testcase_44 AC 742 ms
42,368 KB
testcase_45 AC 735 ms
42,368 KB
testcase_46 AC 734 ms
42,112 KB
testcase_47 AC 776 ms
42,240 KB
testcase_48 AC 749 ms
42,240 KB
testcase_49 AC 734 ms
42,112 KB
testcase_50 AC 762 ms
42,240 KB
testcase_51 AC 767 ms
42,368 KB
testcase_52 AC 765 ms
42,240 KB
testcase_53 AC 803 ms
42,240 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