結果

問題 No.1110 好きな歌
ユーザー granddaifukugranddaifuku
提出日時 2020-07-18 15:53:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 354 ms / 5,000 ms
コード長 737 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 171,768 KB
実行使用メモリ 6,468 KB
最終ジャッジ日時 2023-08-20 12:35:27
合計ジャッジ時間 16,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 194 ms
5,024 KB
testcase_25 AC 246 ms
5,384 KB
testcase_26 AC 125 ms
4,376 KB
testcase_27 AC 233 ms
5,232 KB
testcase_28 AC 134 ms
4,496 KB
testcase_29 AC 277 ms
5,756 KB
testcase_30 AC 133 ms
4,380 KB
testcase_31 AC 83 ms
4,380 KB
testcase_32 AC 318 ms
6,020 KB
testcase_33 AC 154 ms
4,860 KB
testcase_34 AC 204 ms
5,216 KB
testcase_35 AC 315 ms
6,288 KB
testcase_36 AC 35 ms
4,376 KB
testcase_37 AC 90 ms
4,376 KB
testcase_38 AC 282 ms
5,756 KB
testcase_39 AC 200 ms
4,840 KB
testcase_40 AC 258 ms
5,504 KB
testcase_41 AC 21 ms
4,376 KB
testcase_42 AC 293 ms
5,904 KB
testcase_43 AC 284 ms
5,752 KB
testcase_44 AC 322 ms
6,216 KB
testcase_45 AC 343 ms
6,228 KB
testcase_46 AC 333 ms
6,164 KB
testcase_47 AC 354 ms
6,220 KB
testcase_48 AC 345 ms
6,384 KB
testcase_49 AC 320 ms
6,276 KB
testcase_50 AC 335 ms
6,468 KB
testcase_51 AC 332 ms
6,164 KB
testcase_52 AC 349 ms
6,288 KB
testcase_53 AC 352 ms
6,296 KB
権限があれば一括ダウンロードができます

ソースコード

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