結果

問題 No.2803 Bocching Star
ユーザー GOTKAKOGOTKAKO
提出日時 2024-07-12 21:02:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 213,296 KB
実行使用メモリ 6,016 KB
最終ジャッジ日時 2024-07-12 21:02:38
合計ジャッジ時間 5,063 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 8 ms
5,376 KB
testcase_04 AC 43 ms
5,376 KB
testcase_05 AC 21 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 19 ms
5,376 KB
testcase_08 AC 10 ms
5,376 KB
testcase_09 AC 44 ms
5,376 KB
testcase_10 AC 46 ms
5,376 KB
testcase_11 AC 54 ms
5,376 KB
testcase_12 AC 18 ms
5,376 KB
testcase_13 AC 37 ms
5,376 KB
testcase_14 AC 25 ms
5,376 KB
testcase_15 AC 53 ms
5,376 KB
testcase_16 AC 29 ms
5,376 KB
testcase_17 AC 10 ms
5,376 KB
testcase_18 AC 7 ms
5,376 KB
testcase_19 AC 40 ms
5,376 KB
testcase_20 AC 24 ms
5,376 KB
testcase_21 AC 19 ms
5,376 KB
testcase_22 AC 21 ms
5,376 KB
testcase_23 AC 48 ms
5,376 KB
testcase_24 AC 66 ms
6,016 KB
testcase_25 AC 63 ms
5,892 KB
testcase_26 AC 64 ms
5,884 KB
testcase_27 AC 54 ms
5,376 KB
testcase_28 AC 60 ms
5,504 KB
testcase_29 AC 52 ms
5,376 KB
testcase_30 AC 65 ms
6,016 KB
testcase_31 AC 50 ms
5,376 KB
testcase_32 AC 68 ms
5,888 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,S; cin >> N >> S;
    vector<pair<int,int>> A(N);
    for(int i=0; i<N; i++){
        int p; cin >> p;
        A.at(i) = {p,i};
    }
    sort(A.begin(),A.end());

    vector<int> answer;
    for(int i=0; i<N; i++){
        auto [a,pos] = A.at(i);
        bool ok = true;
        if(i){
            auto [a2,ig] = A.at(i-1);
            if(abs(a-a2) <= S) ok = false;
        } 
        if(i != N-1){
            auto [a2,ig] = A.at(i+1);
            if(abs(a-a2) <= S) ok = false;
        }
        if(ok) answer.push_back(pos);
    }
    sort(answer.begin(),answer.end());
    cout << answer.size() << endl;
    for(auto &a : answer) cout << a+1 << " "; cout << endl;
}
0