結果

問題 No.1110 好きな歌
ユーザー ika__si
提出日時 2020-07-11 15:09:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 416 ms / 5,000 ms
コード長 387 bytes
コンパイル時間 1,971 ms
コンパイル使用メモリ 199,488 KB
最終ジャッジ日時 2025-01-11 19:46:15
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n,d;
  cin >> n >> d;
  vector<int> a(n);

  for (int i = 0; i < n; i++) {
      cin >> a[i];
  }

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

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