結果

問題 No.1110 好きな歌
ユーザー chocopuuchocopuu
提出日時 2020-07-13 00:36:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 1,008 bytes
コンパイル時間 2,444 ms
コンパイル使用メモリ 203,032 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-04-24 02:36:17
合計ジャッジ時間 9,316 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 3 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 3 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 80 ms
6,944 KB
testcase_25 AC 97 ms
6,940 KB
testcase_26 AC 51 ms
6,940 KB
testcase_27 AC 95 ms
6,940 KB
testcase_28 AC 55 ms
6,940 KB
testcase_29 AC 113 ms
7,040 KB
testcase_30 AC 55 ms
6,940 KB
testcase_31 AC 34 ms
6,940 KB
testcase_32 AC 124 ms
7,580 KB
testcase_33 AC 62 ms
6,940 KB
testcase_34 AC 84 ms
6,940 KB
testcase_35 AC 129 ms
8,064 KB
testcase_36 AC 16 ms
6,940 KB
testcase_37 AC 38 ms
6,944 KB
testcase_38 AC 111 ms
7,040 KB
testcase_39 AC 83 ms
6,940 KB
testcase_40 AC 102 ms
6,944 KB
testcase_41 AC 9 ms
6,940 KB
testcase_42 AC 118 ms
7,500 KB
testcase_43 AC 111 ms
7,168 KB
testcase_44 AC 129 ms
7,840 KB
testcase_45 AC 133 ms
7,900 KB
testcase_46 AC 134 ms
7,920 KB
testcase_47 AC 137 ms
7,936 KB
testcase_48 AC 134 ms
7,936 KB
testcase_49 AC 128 ms
7,852 KB
testcase_50 AC 132 ms
8,008 KB
testcase_51 AC 133 ms
8,064 KB
testcase_52 AC 135 ms
8,064 KB
testcase_53 AC 136 ms
7,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;


signed main(){
	int N, D;
	cin >> N >> D;
	vector<pair<int,int>>a(N);
	REP(i, N) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(ALL(a));
	vector<int>ans(N);
	REP(i, N) {
		ans[a[i].second] = upper_bound(ALL(a), make_pair(a[i].first - D, INF)) - a.begin();
	}
	REP(i, N) {
		out(ans[i]);
	}
}
0