結果

問題 No.1110 好きな歌
ユーザー oriekaorieka
提出日時 2020-07-10 23:28:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 533 ms / 5,000 ms
コード長 691 bytes
コンパイル時間 1,065 ms
コンパイル使用メモリ 113,084 KB
実行使用メモリ 14,000 KB
最終ジャッジ日時 2023-08-01 23:20:14
合計ジャッジ時間 15,787 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 292 ms
9,708 KB
testcase_25 AC 372 ms
11,088 KB
testcase_26 AC 179 ms
7,120 KB
testcase_27 AC 361 ms
10,680 KB
testcase_28 AC 194 ms
7,480 KB
testcase_29 AC 423 ms
12,016 KB
testcase_30 AC 194 ms
7,520 KB
testcase_31 AC 113 ms
5,708 KB
testcase_32 AC 477 ms
13,084 KB
testcase_33 AC 226 ms
8,384 KB
testcase_34 AC 319 ms
9,956 KB
testcase_35 AC 521 ms
13,804 KB
testcase_36 AC 46 ms
4,528 KB
testcase_37 AC 128 ms
5,928 KB
testcase_38 AC 420 ms
12,024 KB
testcase_39 AC 307 ms
9,772 KB
testcase_40 AC 411 ms
11,808 KB
testcase_41 AC 26 ms
4,376 KB
testcase_42 AC 466 ms
12,808 KB
testcase_43 AC 419 ms
12,008 KB
testcase_44 AC 533 ms
13,860 KB
testcase_45 AC 523 ms
14,000 KB
testcase_46 AC 529 ms
13,996 KB
testcase_47 AC 529 ms
13,896 KB
testcase_48 AC 529 ms
13,976 KB
testcase_49 AC 513 ms
13,856 KB
testcase_50 AC 524 ms
13,932 KB
testcase_51 AC 520 ms
13,852 KB
testcase_52 AC 523 ms
13,816 KB
testcase_53 AC 520 ms
13,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n, d;
	cin >> n >> d;
	
	vector<int> a(n), tmp;
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	tmp = a;
	sort(a.begin(), a.end());

	map<int, int> ret;
	for(int i = 0; i < n; ++i) {
		ret[a[i]] = upper_bound(a.begin(), a.end(), a[i] - d) - a.begin();
	}
	
	for(auto& x : tmp) {
		cout << ret[x] << endl;
	}
	
	return 0;
}
0