結果

問題 No.1110 好きな歌
ユーザー iqueue02iqueue02
提出日時 2020-07-10 21:47:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 390 ms / 5,000 ms
コード長 481 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 200,220 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 16:39:55
合計ジャッジ時間 13,048 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 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 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 208 ms
5,376 KB
testcase_25 AC 270 ms
5,376 KB
testcase_26 AC 140 ms
5,376 KB
testcase_27 AC 264 ms
5,376 KB
testcase_28 AC 148 ms
5,376 KB
testcase_29 AC 326 ms
5,376 KB
testcase_30 AC 146 ms
5,376 KB
testcase_31 AC 89 ms
5,376 KB
testcase_32 AC 341 ms
5,376 KB
testcase_33 AC 173 ms
5,376 KB
testcase_34 AC 228 ms
5,376 KB
testcase_35 AC 337 ms
5,376 KB
testcase_36 AC 39 ms
5,376 KB
testcase_37 AC 98 ms
5,376 KB
testcase_38 AC 302 ms
5,376 KB
testcase_39 AC 224 ms
5,376 KB
testcase_40 AC 271 ms
5,376 KB
testcase_41 AC 23 ms
5,376 KB
testcase_42 AC 315 ms
5,376 KB
testcase_43 AC 310 ms
5,376 KB
testcase_44 AC 351 ms
5,376 KB
testcase_45 AC 365 ms
5,376 KB
testcase_46 AC 365 ms
5,376 KB
testcase_47 AC 387 ms
5,376 KB
testcase_48 AC 383 ms
5,376 KB
testcase_49 AC 347 ms
5,376 KB
testcase_50 AC 373 ms
5,376 KB
testcase_51 AC 378 ms
5,376 KB
testcase_52 AC 380 ms
5,376 KB
testcase_53 AC 390 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

int main() {
  int n, d;
  cin >> n >> d;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  auto b = a;
  sort(b.begin(), b.end());

  for (int i = 0; i < n; i++) {
    int x = a[i] - d;
    auto itr = upper_bound(b.begin(), b.end(), x) - b.begin();
    cout << itr << endl;
  }
  return 0;
} 
0