結果

問題 No.2803 Bocching Star
ユーザー kentikenti
提出日時 2024-07-12 21:38:49
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 112,560 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-12 21:38:56
合計ジャッジ時間 5,927 ms
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 99 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 11 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 22 ms
6,940 KB
testcase_09 AC 100 ms
6,940 KB
testcase_10 AC 108 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 88 ms
6,944 KB
testcase_14 AC 59 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 21 ms
6,944 KB
testcase_18 AC 15 ms
6,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 47 ms
6,940 KB
testcase_23 AC 117 ms
6,940 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 130 ms
6,944 KB
testcase_29 AC 118 ms
6,940 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 200000, INF = (int)1e9 + 1;
int n, s;
P p[MAX_N];

int main() {
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        p[i] = make_pair(tmp, i + 1);
    }
    sort(p, p + n);
    priority_queue<int, vector<int>, greater<int>> que;
    int tmp = -INF;
    for (int i = 0; i + 1 < n; i++) {
        if (p[i].first - tmp > s && p[i + 1].first - p[i].first > s)
            que.push(p[i].second);
        tmp = p[i].first; 
    }
    if (n >= 2 && p[n - 1].first - p[n - 2].first > s)
        que.push(n);
    if (n == 1)
        que.push(1);
    cout << que.size() << endl;
    while (!que.empty()) {
        cout << que.top() << " ";
        que.pop();
    }
    cout << endl;
    return 0;
}
0