結果

問題 No.1110 好きな歌
ユーザー MakutamotoMakutamoto
提出日時 2020-07-10 21:58:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 363 ms / 5,000 ms
コード長 1,778 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 171,304 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 17:04:00
合計ジャッジ時間 11,615 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 3 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 3 ms
6,940 KB
testcase_17 AC 3 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 3 ms
6,944 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 218 ms
6,940 KB
testcase_25 AC 240 ms
6,940 KB
testcase_26 AC 129 ms
6,940 KB
testcase_27 AC 263 ms
6,940 KB
testcase_28 AC 140 ms
6,940 KB
testcase_29 AC 293 ms
6,944 KB
testcase_30 AC 135 ms
6,940 KB
testcase_31 AC 85 ms
6,940 KB
testcase_32 AC 320 ms
6,940 KB
testcase_33 AC 157 ms
6,940 KB
testcase_34 AC 210 ms
6,944 KB
testcase_35 AC 323 ms
6,940 KB
testcase_36 AC 37 ms
6,940 KB
testcase_37 AC 97 ms
6,940 KB
testcase_38 AC 290 ms
6,940 KB
testcase_39 AC 213 ms
6,944 KB
testcase_40 AC 278 ms
6,940 KB
testcase_41 AC 22 ms
6,940 KB
testcase_42 AC 314 ms
6,940 KB
testcase_43 AC 294 ms
6,944 KB
testcase_44 AC 330 ms
6,940 KB
testcase_45 AC 361 ms
6,944 KB
testcase_46 AC 338 ms
6,940 KB
testcase_47 AC 352 ms
6,940 KB
testcase_48 AC 344 ms
6,940 KB
testcase_49 AC 326 ms
6,944 KB
testcase_50 AC 342 ms
6,944 KB
testcase_51 AC 341 ms
6,940 KB
testcase_52 AC 355 ms
6,940 KB
testcase_53 AC 363 ms
6,940 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