結果

問題 No.2803 Bocching Star
ユーザー silv723silv723
提出日時 2024-07-05 10:22:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 208,120 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2024-07-05 10:29:49
合計ジャッジ時間 6,453 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 14 ms
5,376 KB
testcase_04 AC 94 ms
5,632 KB
testcase_05 AC 49 ms
5,376 KB
testcase_06 AC 10 ms
5,376 KB
testcase_07 AC 36 ms
5,376 KB
testcase_08 AC 21 ms
5,376 KB
testcase_09 AC 100 ms
5,632 KB
testcase_10 AC 106 ms
5,760 KB
testcase_11 AC 104 ms
6,016 KB
testcase_12 AC 33 ms
5,376 KB
testcase_13 AC 84 ms
5,376 KB
testcase_14 AC 58 ms
5,376 KB
testcase_15 AC 104 ms
5,964 KB
testcase_16 AC 56 ms
5,376 KB
testcase_17 AC 18 ms
5,376 KB
testcase_18 AC 15 ms
5,376 KB
testcase_19 AC 90 ms
5,376 KB
testcase_20 AC 53 ms
5,376 KB
testcase_21 AC 42 ms
5,376 KB
testcase_22 AC 43 ms
5,376 KB
testcase_23 AC 110 ms
6,016 KB
testcase_24 AC 123 ms
6,784 KB
testcase_25 AC 119 ms
6,908 KB
testcase_26 AC 119 ms
6,904 KB
testcase_27 AC 115 ms
6,268 KB
testcase_28 AC 118 ms
6,268 KB
testcase_29 AC 112 ms
6,016 KB
testcase_30 AC 119 ms
6,904 KB
testcase_31 AC 107 ms
6,016 KB
testcase_32 AC 121 ms
6,912 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, s;
	cin >> n >> s;
	assert(1 <= n && n <= 200000);
	assert(0 <= s && s <= 1000000000);
	vector<int> p(n);
	for(int i = 0; i < n; i++){
		cin >> p[i];
		assert(0 <= p[i] && p[i] <= 1000000000);
	}
	vector<int> ind(n);
	for(int i = 0; i < n; i++) ind[i] = i;
	sort(ind.begin(), ind.end(), [&](int i, int j){
		return p[i] < p[j];
	});
	vector<int> ans(n, 1);
	for(int i = 0; i < n; i++){
		if(i != 0 && p[ind[i]] - p[ind[i-1]] <= s){
			ans[ind[i]] = 0;
			ans[ind[i-1]] = 0;
		}
	}
	vector<int> fans;
	for(int i = 0; i < n; i++) if(ans[i] == 1) fans.push_back(i+1);
	cout << (int)fans.size() << '\n';
	for(int i = 0; i < (int)fans.size(); i++){
		if(i == (int)fans.size()-1) cout << fans[i] << '\n';
		else cout << fans[i] << " ";
	}
}
0