結果

問題 No.1110 好きな歌
ユーザー MakutamotoMakutamoto
提出日時 2020-07-10 21:58:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 383 ms / 5,000 ms
コード長 1,778 bytes
コンパイル時間 1,635 ms
コンパイル使用メモリ 170,896 KB
実行使用メモリ 6,440 KB
最終ジャッジ日時 2023-08-01 17:51:53
合計ジャッジ時間 12,596 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 209 ms
4,824 KB
testcase_25 AC 253 ms
5,512 KB
testcase_26 AC 132 ms
4,380 KB
testcase_27 AC 265 ms
5,244 KB
testcase_28 AC 148 ms
4,384 KB
testcase_29 AC 307 ms
5,720 KB
testcase_30 AC 136 ms
4,380 KB
testcase_31 AC 88 ms
4,380 KB
testcase_32 AC 340 ms
5,868 KB
testcase_33 AC 162 ms
4,552 KB
testcase_34 AC 222 ms
5,164 KB
testcase_35 AC 340 ms
6,184 KB
testcase_36 AC 37 ms
4,376 KB
testcase_37 AC 100 ms
4,380 KB
testcase_38 AC 299 ms
5,608 KB
testcase_39 AC 216 ms
4,836 KB
testcase_40 AC 264 ms
5,400 KB
testcase_41 AC 21 ms
4,376 KB
testcase_42 AC 320 ms
6,044 KB
testcase_43 AC 290 ms
5,664 KB
testcase_44 AC 344 ms
6,440 KB
testcase_45 AC 346 ms
6,156 KB
testcase_46 AC 353 ms
6,312 KB
testcase_47 AC 383 ms
6,140 KB
testcase_48 AC 371 ms
6,184 KB
testcase_49 AC 340 ms
6,244 KB
testcase_50 AC 366 ms
6,252 KB
testcase_51 AC 353 ms
6,220 KB
testcase_52 AC 362 ms
6,180 KB
testcase_53 AC 364 ms
6,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, D;
    cin >> N >> D;
    vector<ll> A(N), B;
    rep(i, N) cin >> A[i];
    B = A;
    sort(B.begin(), B.end());
    iter(i, A) {
        ll d = i - D;
        auto iter = upper_bound(B.begin(), B.end(), d);
        cout << distance(B.begin(), iter) << endl;
    }
    return 0;
}
0