結果

問題 No.1110 好きな歌
ユーザー trineutrontrineutron
提出日時 2019-10-12 18:39:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 677 bytes
コンパイル時間 1,648 ms
コンパイル使用メモリ 173,676 KB
実行使用メモリ 4,592 KB
最終ジャッジ日時 2023-10-11 11:17:22
合計ジャッジ時間 10,454 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    assert(1 <= n && n <= 100000);
    assert(1 <= d && d <= 1000000000);
    vector<pair<int, int>> p;
    for (int i = 0; i < n; i++) {
        int a_i;
        cin >> a_i;
        assert(1 <= a_i && a_i <= 1000000000);
        p.emplace_back(a_i, i);
    }
    sort(p.begin(), p.end());
    vector<int> a(n), ans(n);
    for (int i = 0; i < n; i++) a.at(i) = p.at(i).first;
    for (int i = 0; i < n; i++) {
        ans.at(p.at(i).second) = upper_bound(a.begin(), a.end(), a.at(i) - d) - a.begin();
    }
    for (int i = 0; i < n; i++) {
        cout << ans.at(i) << endl;
    }
}
0