結果

問題 No.1110 好きな歌
ユーザー cn_449cn_449
提出日時 2020-07-10 21:25:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 1,436 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 118,608 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-04-19 15:31:05
合計ジャッジ時間 5,497 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 42 ms
5,376 KB
testcase_25 AC 52 ms
5,376 KB
testcase_26 AC 29 ms
5,376 KB
testcase_27 AC 52 ms
5,376 KB
testcase_28 AC 28 ms
5,376 KB
testcase_29 AC 67 ms
5,376 KB
testcase_30 AC 25 ms
5,376 KB
testcase_31 AC 18 ms
5,376 KB
testcase_32 AC 73 ms
5,376 KB
testcase_33 AC 29 ms
5,376 KB
testcase_34 AC 44 ms
5,376 KB
testcase_35 AC 61 ms
5,632 KB
testcase_36 AC 7 ms
5,376 KB
testcase_37 AC 22 ms
5,376 KB
testcase_38 AC 68 ms
5,376 KB
testcase_39 AC 49 ms
5,376 KB
testcase_40 AC 48 ms
5,376 KB
testcase_41 AC 6 ms
5,376 KB
testcase_42 AC 59 ms
5,504 KB
testcase_43 AC 66 ms
5,376 KB
testcase_44 AC 66 ms
5,504 KB
testcase_45 AC 78 ms
5,504 KB
testcase_46 AC 73 ms
5,760 KB
testcase_47 AC 85 ms
5,760 KB
testcase_48 AC 75 ms
5,632 KB
testcase_49 AC 58 ms
5,760 KB
testcase_50 AC 73 ms
5,504 KB
testcase_51 AC 67 ms
5,632 KB
testcase_52 AC 73 ms
5,760 KB
testcase_53 AC 84 ms
5,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n';
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, d;
	cin >> n >> d;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<int> b = a; sort(all(b));  b.pb(inf);
	rep(i, n) {
		cout << upper_bound(all(b), a[i] - d) - b.begin() << '\n';
	}
}
0