結果

問題 No.1110 好きな歌
ユーザー misora192misora192
提出日時 2020-07-10 22:37:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 337 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 1,782 ms
コンパイル使用メモリ 171,084 KB
実行使用メモリ 6,340 KB
最終ジャッジ日時 2023-08-01 18:40:37
合計ジャッジ時間 11,973 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 3 ms
4,384 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,504 KB
testcase_24 AC 188 ms
4,868 KB
testcase_25 AC 226 ms
5,396 KB
testcase_26 AC 120 ms
4,380 KB
testcase_27 AC 225 ms
5,132 KB
testcase_28 AC 129 ms
4,380 KB
testcase_29 AC 273 ms
5,652 KB
testcase_30 AC 122 ms
4,380 KB
testcase_31 AC 78 ms
4,380 KB
testcase_32 AC 303 ms
5,884 KB
testcase_33 AC 141 ms
4,760 KB
testcase_34 AC 192 ms
5,284 KB
testcase_35 AC 300 ms
6,260 KB
testcase_36 AC 33 ms
4,376 KB
testcase_37 AC 88 ms
4,380 KB
testcase_38 AC 268 ms
5,740 KB
testcase_39 AC 197 ms
4,876 KB
testcase_40 AC 239 ms
5,348 KB
testcase_41 AC 20 ms
4,376 KB
testcase_42 AC 271 ms
5,928 KB
testcase_43 AC 265 ms
5,632 KB
testcase_44 AC 308 ms
6,136 KB
testcase_45 AC 321 ms
6,340 KB
testcase_46 AC 307 ms
6,188 KB
testcase_47 AC 333 ms
6,188 KB
testcase_48 AC 321 ms
6,264 KB
testcase_49 AC 295 ms
6,208 KB
testcase_50 AC 326 ms
6,164 KB
testcase_51 AC 316 ms
6,264 KB
testcase_52 AC 315 ms
6,140 KB
testcase_53 AC 337 ms
6,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll n, d;
	cin >> n >> d;

	vector<ll> a(n), b(n);
	rep(i, n){
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b.begin(), b.end());
	rep(i, n){
		auto it = upper_bound(b.begin(), b.end(), a[i] - d);
		cout << it - b.begin() << endl;
	}
}	
0