結果

問題 No.1110 好きな歌
ユーザー どららどらら
提出日時 2020-07-10 22:15:43
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 353 ms / 5,000 ms
コード長 746 bytes
コンパイル時間 1,552 ms
コンパイル使用メモリ 169,816 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 17:28:37
合計ジャッジ時間 11,392 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 1 ms
6,812 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 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,940 KB
testcase_20 AC 3 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 3 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 200 ms
6,940 KB
testcase_25 AC 245 ms
6,940 KB
testcase_26 AC 126 ms
6,944 KB
testcase_27 AC 239 ms
6,940 KB
testcase_28 AC 141 ms
6,944 KB
testcase_29 AC 286 ms
6,940 KB
testcase_30 AC 136 ms
6,940 KB
testcase_31 AC 83 ms
6,944 KB
testcase_32 AC 318 ms
6,940 KB
testcase_33 AC 153 ms
6,944 KB
testcase_34 AC 213 ms
6,944 KB
testcase_35 AC 321 ms
6,940 KB
testcase_36 AC 36 ms
6,940 KB
testcase_37 AC 95 ms
6,944 KB
testcase_38 AC 280 ms
6,944 KB
testcase_39 AC 207 ms
6,944 KB
testcase_40 AC 247 ms
6,944 KB
testcase_41 AC 21 ms
6,944 KB
testcase_42 AC 293 ms
6,940 KB
testcase_43 AC 282 ms
6,944 KB
testcase_44 AC 326 ms
6,940 KB
testcase_45 AC 347 ms
6,944 KB
testcase_46 AC 337 ms
6,944 KB
testcase_47 AC 353 ms
6,940 KB
testcase_48 AC 345 ms
6,940 KB
testcase_49 AC 315 ms
6,940 KB
testcase_50 AC 344 ms
6,944 KB
testcase_51 AC 336 ms
6,944 KB
testcase_52 AC 340 ms
6,944 KB
testcase_53 AC 350 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int solve(const vector<int>& v, int x){
  if(x <= 0) return 0;

  int lb = -1, ub = v.size();
  while(ub-lb>1){
    int m = (lb+ub)/2;
    if(v[m] <= x) lb = m;
    else ub = m;
  }
  return ub;
}


int main(){
  int N, D;
  cin >> N >> D;
  vector<int> v, w;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
    w.push_back(a);
  }
  sort(ALLOF(w));

  rep(i,N){
    int a = v[i];
    cout << solve(w, a-D) << endl;
  }

  return 0;
}

0