結果

問題 No.1110 好きな歌
ユーザー nok0nok0
提出日時 2020-07-10 21:31:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 546 ms / 5,000 ms
コード長 1,611 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 208,436 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-04-19 15:51:17
合計ジャッジ時間 16,197 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 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 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 277 ms
12,544 KB
testcase_25 AC 372 ms
14,464 KB
testcase_26 AC 173 ms
9,216 KB
testcase_27 AC 354 ms
14,336 KB
testcase_28 AC 197 ms
9,600 KB
testcase_29 AC 424 ms
16,000 KB
testcase_30 AC 191 ms
9,856 KB
testcase_31 AC 106 ms
7,168 KB
testcase_32 AC 463 ms
17,536 KB
testcase_33 AC 214 ms
10,752 KB
testcase_34 AC 301 ms
13,184 KB
testcase_35 AC 524 ms
18,688 KB
testcase_36 AC 44 ms
5,376 KB
testcase_37 AC 124 ms
7,424 KB
testcase_38 AC 426 ms
15,744 KB
testcase_39 AC 303 ms
12,672 KB
testcase_40 AC 389 ms
15,616 KB
testcase_41 AC 24 ms
5,376 KB
testcase_42 AC 456 ms
17,280 KB
testcase_43 AC 405 ms
16,000 KB
testcase_44 AC 508 ms
18,688 KB
testcase_45 AC 507 ms
18,816 KB
testcase_46 AC 507 ms
18,688 KB
testcase_47 AC 529 ms
18,816 KB
testcase_48 AC 522 ms
18,816 KB
testcase_49 AC 517 ms
18,688 KB
testcase_50 AC 524 ms
18,816 KB
testcase_51 AC 518 ms
18,816 KB
testcase_52 AC 546 ms
18,816 KB
testcase_53 AC 536 ms
18,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, d;  cin >> n >> d;
    V<> a(n), b(n);
    REP(i, n) cin >> a[i];
    b = a;
    sort(all(a));
    map<ll,ll> mp;
    REP(i, n){
        int itr = upper_bound(all(a),a[i] - d) - a.begin();
        mp[a[i]] = itr;
    }
    REP(i, n) cout << mp[b[i]] << endl;
}
0