結果

問題 No.2803 Bocching Star
ユーザー vikashprgmvikashprgm
提出日時 2024-07-20 22:56:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 851 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 210,056 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 22:56:29
合計ジャッジ時間 6,208 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 15 ms
5,376 KB
testcase_04 AC 85 ms
7,000 KB
testcase_05 AC 43 ms
5,376 KB
testcase_06 AC 9 ms
5,376 KB
testcase_07 AC 34 ms
5,392 KB
testcase_08 AC 18 ms
5,376 KB
testcase_09 AC 92 ms
6,272 KB
testcase_10 AC 91 ms
6,912 KB
testcase_11 AC 99 ms
8,064 KB
testcase_12 AC 32 ms
5,376 KB
testcase_13 AC 74 ms
6,400 KB
testcase_14 AC 51 ms
5,376 KB
testcase_15 AC 102 ms
8,304 KB
testcase_16 AC 55 ms
6,912 KB
testcase_17 AC 18 ms
5,376 KB
testcase_18 AC 11 ms
5,376 KB
testcase_19 AC 77 ms
6,400 KB
testcase_20 AC 51 ms
5,376 KB
testcase_21 AC 44 ms
5,376 KB
testcase_22 AC 40 ms
5,540 KB
testcase_23 AC 98 ms
7,560 KB
testcase_24 AC 122 ms
10,584 KB
testcase_25 AC 115 ms
10,752 KB
testcase_26 AC 122 ms
10,628 KB
testcase_27 AC 105 ms
8,580 KB
testcase_28 AC 117 ms
8,576 KB
testcase_29 AC 112 ms
7,556 KB
testcase_30 AC 119 ms
10,524 KB
testcase_31 AC 100 ms
7,432 KB
testcase_32 AC 137 ms
10,628 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// author - v1kash
#include <bits/stdc++.h>
using namespace std;
int main(){
    #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin); 
  freopen("output.txt","w",stdout);
  #endif
long n,s;
cin>>n>>s;
if(n==1){
    int p;
    cin>>p;
    cout<<1<<'\n';
    cout<<1;
    return 0;
}
vector<pair<long,long>> v(n);
vector<pair<long,long>> ans;
for(int i=0;i<n;i++) {cin>>v[i].first;v[i].second=i+1;}
// 1 3 6 10 s=2
sort(v.begin(),v.end());
for(int i=1;i<v.size()-1;i++){
    if(v[i].first-v[i-1].first>s && v[i+1].first-v[i].first>s) ans.push_back(v[i]);
}
if(v[n-1].first-v[n-2].first>s) ans.push_back(v[n-1]);
if(v[1].first-v[0].first>s)ans.push_back(v[0]);
sort(ans.begin(), ans.end(), [](auto &left, auto &right) {
    return left.second < right.second;
});
cout<<ans.size()<<'\n';
for(int i=0;i<ans.size();i++){
    cout<<ans[i].second<<" ";
}

}
0