結果

問題 No.2803 Bocching Star
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-07-13 20:30:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 899 bytes
コンパイル時間 2,496 ms
コンパイル使用メモリ 208,656 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-13 20:30:13
合計ジャッジ時間 7,539 ms
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 16 ms
6,944 KB
testcase_04 AC 95 ms
6,940 KB
testcase_05 AC 50 ms
6,944 KB
testcase_06 AC 10 ms
6,940 KB
testcase_07 AC 39 ms
6,944 KB
testcase_08 AC 20 ms
6,944 KB
testcase_09 AC 98 ms
6,940 KB
testcase_10 AC 109 ms
6,940 KB
testcase_11 AC 110 ms
6,944 KB
testcase_12 AC 35 ms
6,940 KB
testcase_13 AC 81 ms
6,940 KB
testcase_14 AC 57 ms
6,944 KB
testcase_15 AC 110 ms
6,940 KB
testcase_16 AC 61 ms
6,940 KB
testcase_17 AC 20 ms
6,940 KB
testcase_18 AC 15 ms
6,948 KB
testcase_19 AC 88 ms
6,940 KB
testcase_20 AC 55 ms
6,944 KB
testcase_21 AC 42 ms
6,944 KB
testcase_22 AC 45 ms
6,940 KB
testcase_23 AC 113 ms
6,944 KB
testcase_24 AC 140 ms
6,940 KB
testcase_25 AC 129 ms
6,944 KB
testcase_26 AC 128 ms
6,940 KB
testcase_27 AC 118 ms
6,944 KB
testcase_28 AC 123 ms
6,940 KB
testcase_29 AC 116 ms
6,944 KB
testcase_30 AC 132 ms
6,940 KB
testcase_31 AC 115 ms
6,940 KB
testcase_32 AC 140 ms
6,944 KB
testcase_33 AC 3 ms
6,940 KB
testcase_34 AC 3 ms
6,944 KB
testcase_35 AC 3 ms
6,940 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;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main(){
    int n, s;
    cin >> n >> s;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    vector<int> a(n);
    iota(a.begin(), a.end(), 0);
    sort(a.begin(), a.end(), [&](int i, int j){
        return p[i] < p[j];
    });
    vector<int> ans;
    for(int i = 0; i < n; i++){
        bool is_bocchi = true;
        if(i > 0 && p[a[i]] - p[a[i - 1]] <= s){
            is_bocchi = false;
        }
        if(i < n - 1 && p[a[i + 1]] - p[a[i]] <= s){
            is_bocchi = false;
        }
        if(is_bocchi){
            ans.push_back(a[i]);
        }
    }
    sort(ans.begin(), ans.end());
    cout << ans.size() << "\n";
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] + 1 << " ";
    }
    cout << "\n";
} 
0