結果

問題 No.1110 好きな歌
ユーザー oriekaorieka
提出日時 2020-07-10 23:28:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 493 ms / 5,000 ms
コード長 691 bytes
コンパイル時間 1,162 ms
コンパイル使用メモリ 114,856 KB
実行使用メモリ 14,464 KB
最終ジャッジ日時 2024-04-20 00:04:32
合計ジャッジ時間 14,043 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,948 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 3 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 3 ms
6,944 KB
testcase_20 AC 3 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 3 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 268 ms
9,984 KB
testcase_25 AC 342 ms
11,136 KB
testcase_26 AC 163 ms
7,296 KB
testcase_27 AC 328 ms
11,008 KB
testcase_28 AC 184 ms
7,808 KB
testcase_29 AC 396 ms
12,160 KB
testcase_30 AC 180 ms
7,680 KB
testcase_31 AC 106 ms
6,940 KB
testcase_32 AC 435 ms
13,184 KB
testcase_33 AC 210 ms
8,448 KB
testcase_34 AC 289 ms
10,240 KB
testcase_35 AC 478 ms
14,080 KB
testcase_36 AC 45 ms
6,940 KB
testcase_37 AC 117 ms
6,940 KB
testcase_38 AC 396 ms
12,032 KB
testcase_39 AC 288 ms
10,112 KB
testcase_40 AC 368 ms
11,904 KB
testcase_41 AC 25 ms
6,940 KB
testcase_42 AC 427 ms
13,056 KB
testcase_43 AC 396 ms
12,160 KB
testcase_44 AC 473 ms
14,208 KB
testcase_45 AC 490 ms
14,208 KB
testcase_46 AC 493 ms
14,208 KB
testcase_47 AC 483 ms
14,208 KB
testcase_48 AC 476 ms
14,208 KB
testcase_49 AC 463 ms
14,208 KB
testcase_50 AC 478 ms
14,336 KB
testcase_51 AC 486 ms
14,464 KB
testcase_52 AC 471 ms
14,464 KB
testcase_53 AC 476 ms
14,208 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