結果

問題 No.1110 好きな歌
ユーザー onsen_manjuuuonsen_manjuuu
提出日時 2020-07-12 03:07:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 396 ms / 5,000 ms
コード長 471 bytes
コンパイル時間 2,279 ms
コンパイル使用メモリ 172,156 KB
実行使用メモリ 6,908 KB
最終ジャッジ日時 2024-04-21 21:12:49
合計ジャッジ時間 14,740 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
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 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 3 ms
5,376 KB
testcase_09 AC 3 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 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 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 3 ms
5,376 KB
testcase_24 AC 226 ms
5,376 KB
testcase_25 AC 270 ms
6,112 KB
testcase_26 AC 145 ms
5,376 KB
testcase_27 AC 269 ms
6,092 KB
testcase_28 AC 159 ms
5,376 KB
testcase_29 AC 317 ms
6,488 KB
testcase_30 AC 157 ms
5,376 KB
testcase_31 AC 97 ms
5,376 KB
testcase_32 AC 356 ms
6,584 KB
testcase_33 AC 181 ms
5,376 KB
testcase_34 AC 241 ms
5,504 KB
testcase_35 AC 370 ms
6,768 KB
testcase_36 AC 42 ms
5,376 KB
testcase_37 AC 105 ms
5,376 KB
testcase_38 AC 306 ms
6,328 KB
testcase_39 AC 234 ms
5,376 KB
testcase_40 AC 314 ms
6,416 KB
testcase_41 AC 24 ms
5,376 KB
testcase_42 AC 329 ms
6,668 KB
testcase_43 AC 315 ms
6,348 KB
testcase_44 AC 374 ms
6,776 KB
testcase_45 AC 378 ms
6,772 KB
testcase_46 AC 383 ms
6,780 KB
testcase_47 AC 389 ms
6,904 KB
testcase_48 AC 379 ms
6,776 KB
testcase_49 AC 369 ms
6,904 KB
testcase_50 AC 382 ms
6,900 KB
testcase_51 AC 379 ms
6,780 KB
testcase_52 AC 380 ms
6,780 KB
testcase_53 AC 396 ms
6,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main()
{
    int n, d; cin >> n >> d;
    vector<pair<int,int>> a(n);
    for(int i = 0; i < n; i++)cin >> a[i].first, a[i].second = i;
    sort(a.begin(), a.end());
    vector<int> u, ans(n);
    for(auto i : a)u.push_back(i.first);

    for(int i = 0; i < n; i++) {
        ans[a[i].second] = upper_bound(u.begin(), u.end(), u[i] - d) - u.begin();
    }
    for(auto i : ans)cout << i << endl;
}
0