結果

問題 No.1110 好きな歌
ユーザー NoviNovi
提出日時 2020-07-11 14:19:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 345 ms / 5,000 ms
コード長 816 bytes
コンパイル時間 1,770 ms
コンパイル使用メモリ 171,024 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2024-04-21 03:01:58
合計ジャッジ時間 12,048 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 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,944 KB
testcase_21 AC 3 ms
6,944 KB
testcase_22 AC 3 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 192 ms
6,940 KB
testcase_25 AC 239 ms
7,396 KB
testcase_26 AC 125 ms
6,940 KB
testcase_27 AC 235 ms
7,268 KB
testcase_28 AC 134 ms
6,944 KB
testcase_29 AC 279 ms
7,524 KB
testcase_30 AC 127 ms
6,944 KB
testcase_31 AC 83 ms
6,944 KB
testcase_32 AC 315 ms
7,652 KB
testcase_33 AC 148 ms
6,940 KB
testcase_34 AC 200 ms
6,940 KB
testcase_35 AC 315 ms
7,784 KB
testcase_36 AC 34 ms
6,940 KB
testcase_37 AC 92 ms
6,940 KB
testcase_38 AC 277 ms
7,392 KB
testcase_39 AC 202 ms
6,944 KB
testcase_40 AC 246 ms
7,396 KB
testcase_41 AC 21 ms
6,944 KB
testcase_42 AC 286 ms
7,780 KB
testcase_43 AC 272 ms
7,392 KB
testcase_44 AC 321 ms
7,780 KB
testcase_45 AC 342 ms
7,780 KB
testcase_46 AC 322 ms
7,908 KB
testcase_47 AC 337 ms
7,784 KB
testcase_48 AC 333 ms
7,780 KB
testcase_49 AC 306 ms
7,908 KB
testcase_50 AC 333 ms
7,908 KB
testcase_51 AC 320 ms
7,784 KB
testcase_52 AC 333 ms
7,908 KB
testcase_53 AC 345 ms
7,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n,d;
    cin>>n>>d;
    vector<long long>a(0);
    for(int i=0; i<n; i++){
        long long aa; cin>>aa;
        a.emplace_back(aa);
    }
    vector<long long>b(0);
    for(int i=0; i<n; i++){
        b.emplace_back((d+a[i])*(-1));
    }
    sort(b.begin(), b.end());
    for(int i=0; i<n; i++){
        long long cnt= a[i]*(-1);
        auto ans=lower_bound(b.begin(), b.end(), cnt);
        cout<<n-distance(b.begin(),ans)<<endl;
    }

    return 0;
}
0