結果

問題 No.2803 Bocching Star
ユーザー Akshaj PadmakarAkshaj Padmakar
提出日時 2024-07-12 21:24:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 1,088 bytes
コンパイル時間 1,929 ms
コンパイル使用メモリ 179,156 KB
実行使用メモリ 9,812 KB
最終ジャッジ日時 2024-07-12 21:24:44
合計ジャッジ時間 5,455 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 49 ms
8,552 KB
testcase_05 AC 24 ms
6,940 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 AC 21 ms
6,944 KB
testcase_08 AC 12 ms
6,940 KB
testcase_09 AC 47 ms
8,048 KB
testcase_10 AC 51 ms
8,428 KB
testcase_11 AC 60 ms
7,844 KB
testcase_12 AC 19 ms
6,940 KB
testcase_13 AC 42 ms
8,428 KB
testcase_14 AC 28 ms
6,944 KB
testcase_15 AC 63 ms
8,036 KB
testcase_16 AC 35 ms
6,940 KB
testcase_17 AC 12 ms
6,944 KB
testcase_18 AC 8 ms
6,944 KB
testcase_19 AC 44 ms
8,432 KB
testcase_20 AC 28 ms
6,940 KB
testcase_21 AC 22 ms
6,944 KB
testcase_22 AC 25 ms
6,944 KB
testcase_23 AC 56 ms
8,684 KB
testcase_24 AC 75 ms
9,744 KB
testcase_25 AC 70 ms
9,468 KB
testcase_26 AC 73 ms
9,524 KB
testcase_27 AC 61 ms
8,044 KB
testcase_28 AC 67 ms
9,328 KB
testcase_29 AC 59 ms
7,916 KB
testcase_30 AC 75 ms
9,684 KB
testcase_31 AC 56 ms
8,684 KB
testcase_32 AC 106 ms
9,812 KB
testcase_33 AC 3 ms
6,940 KB
testcase_34 AC 3 ms
6,940 KB
testcase_35 AC 3 ms
6,944 KB
testcase_36 AC 3 ms
6,940 KB
testcase_37 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#ifndef ONLINE_JUDGE
#include "algo/debug.h"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long

void solve() {
	int n, s;
	cin >> n >> s;
	vector<pair<int, int>> a;
	for (int i = 0, x; i < n; i++) {
		cin >> x;
		a.push_back({x, i + 1});
	}
	sort(a.begin(), a.end());
	vector<int> ans;
	for (int i = 0; i < n; i++) {
		bool ok = 1;
		if (i) {
			if (a[i].first - a[i - 1].first <= s) {
				ok = false;
			}
		}

		if (i < n - 1) {
			if (a[i + 1].first - a[i].first <= s) {
				ok = false;
			}
		}
		if (ok) {
			ans.push_back(a[i].second);
		}
	}
	sort(ans.begin(), ans.end());

	cout << ans.size() << '\n';
	for (auto &x : ans) {
		cout << x << " ";
	}
}

signed main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
#endif
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int t = 1;
	//cin >> t;

	while (t--) {
		solve();
	}

	// cerr << "Time elapsed: " << ((long double)clock() / CLOCKS_PER_SEC) << " s.\n";
}
0