結果

問題 No.1110 好きな歌
ユーザー granddaifuku
提出日時 2020-07-18 15:53:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 344 ms / 5,000 ms
コード長 737 bytes
コンパイル時間 1,709 ms
コンパイル使用メモリ 172,804 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-11-30 14:16:08
合計ジャッジ時間 12,914 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n;
	ll d;
	cin >> n >> d;
	vector<ll> a(n), b(n);
	rep(i, n) { 
	  cin >> a[i];
	  b[i] = a[i];
	}
    sort(b.rbegin(), b.rend());
	rep(i, n) {
	  int l = 0, r = n, mid;
	  while (r - l > 1) {
		mid = (l + r) / 2;
		if (b[mid] + d <= a[i]) r = mid;
		else l = mid;
	  }
	  cout << n - r << endl;
	}
	

    return 0;
}

0