結果

問題 No.1110 好きな歌
ユーザー forest3
提出日時 2020-07-14 10:54:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 390 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 172,684 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-11-17 00:32:33
合計ジャッジ時間 13,431 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	long long D;
	cin >> N >> D;
	vector<long long> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	vector<long long> a = A;
	sort( a.begin(), a.end() );
	for( int i = 0; i < N; i++ ) {
		long long d = A[i] - D;
		int ans = upper_bound( a.begin(), a.end(), d ) - a.begin();
		cout << ans << endl;
	}

}
0