結果

問題 No.1110 好きな歌
ユーザー hedwig100hedwig100
提出日時 2020-07-10 21:52:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 734 bytes
コンパイル時間 1,515 ms
コンパイル使用メモリ 171,096 KB
実行使用メモリ 5,656 KB
最終ジャッジ日時 2023-08-01 17:39:56
合計ジャッジ時間 7,476 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 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,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 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,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,508 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 72 ms
4,376 KB
testcase_25 AC 89 ms
4,728 KB
testcase_26 AC 47 ms
4,388 KB
testcase_27 AC 87 ms
4,728 KB
testcase_28 AC 49 ms
4,384 KB
testcase_29 AC 106 ms
4,892 KB
testcase_30 AC 46 ms
4,380 KB
testcase_31 AC 30 ms
4,384 KB
testcase_32 AC 115 ms
5,412 KB
testcase_33 AC 51 ms
4,380 KB
testcase_34 AC 74 ms
4,864 KB
testcase_35 AC 111 ms
5,364 KB
testcase_36 AC 13 ms
4,380 KB
testcase_37 AC 35 ms
4,380 KB
testcase_38 AC 105 ms
4,932 KB
testcase_39 AC 77 ms
4,384 KB
testcase_40 AC 86 ms
5,000 KB
testcase_41 AC 8 ms
4,380 KB
testcase_42 AC 102 ms
5,256 KB
testcase_43 AC 104 ms
4,940 KB
testcase_44 AC 114 ms
5,384 KB
testcase_45 AC 123 ms
5,348 KB
testcase_46 AC 121 ms
5,420 KB
testcase_47 AC 131 ms
5,348 KB
testcase_48 AC 122 ms
5,524 KB
testcase_49 AC 106 ms
5,524 KB
testcase_50 AC 121 ms
5,372 KB
testcase_51 AC 116 ms
5,656 KB
testcase_52 AC 122 ms
5,388 KB
testcase_53 AC 130 ms
5,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;
const int tyou[7] = {0,2,4,5,7,9,11};

int main() {
    int N,D; cin >> N >> D;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<int> B = A;
    sort(B.begin(),B.end());
    vector<int> ans(N);

    rep(i,N) {
        int cnt = upper_bound(B.begin(),B.end(),A[i]- D) - B.begin();
        ans[i] = cnt;
    }
    rep(i,N) cout << ans[i] << '\n';
    return 0;
}
0