結果

問題 No.2803 Bocching Star
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2024-07-12 21:44:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 2,290 ms
コンパイル使用メモリ 211,816 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-12 21:44:17
合計ジャッジ時間 7,167 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 16 ms
6,816 KB
testcase_04 AC 97 ms
6,944 KB
testcase_05 AC 50 ms
6,940 KB
testcase_06 AC 11 ms
6,944 KB
testcase_07 AC 39 ms
6,940 KB
testcase_08 AC 21 ms
6,940 KB
testcase_09 AC 100 ms
6,944 KB
testcase_10 AC 108 ms
6,940 KB
testcase_11 AC 114 ms
6,940 KB
testcase_12 AC 36 ms
6,944 KB
testcase_13 AC 86 ms
6,940 KB
testcase_14 AC 69 ms
6,940 KB
testcase_15 AC 115 ms
6,944 KB
testcase_16 AC 62 ms
6,940 KB
testcase_17 AC 21 ms
6,944 KB
testcase_18 AC 15 ms
6,940 KB
testcase_19 AC 91 ms
6,940 KB
testcase_20 AC 55 ms
6,940 KB
testcase_21 AC 42 ms
6,940 KB
testcase_22 AC 44 ms
6,944 KB
testcase_23 AC 114 ms
6,944 KB
testcase_24 AC 137 ms
6,940 KB
testcase_25 AC 130 ms
6,940 KB
testcase_26 AC 134 ms
6,944 KB
testcase_27 AC 118 ms
6,944 KB
testcase_28 AC 126 ms
6,940 KB
testcase_29 AC 115 ms
6,940 KB
testcase_30 AC 134 ms
6,944 KB
testcase_31 AC 113 ms
6,940 KB
testcase_32 AC 138 ms
6,940 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,944 KB
testcase_37 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll const inf = (ll)1e18;
int main () {
	int N, S;
	cin >> N >> S;
	std::vector<ll> P(N + 2) ;
	P[0] = -inf; P[N + 1] = inf;
	for (int i = 1; i <= N; i ++) cin >> P[i];
	vector<int> ID(N + 2);
	iota(ID.begin(), ID.end(), 0);
	sort(ID.begin(), ID.end(), [&](int a, int b) {return P[a] < P[b];});
	vector<int> ans;
	for (int p = 1; p <= N; p ++) {
		int i = ID[p];
		int l = ID[p - 1], r = ID[p + 1];
		if (min(abs(P[l] - P[i]), abs(P[r] - P[i])) > S) {
			ans.push_back(i);
		}
	}
	sort(ans.begin(), ans.end());
	cout << ans.size() << endl;
	for (auto& a : ans) cout << a << (a == ans.back() ? "" : " ");
	cout << endl;
}
0