結果

問題 No.2803 Bocching Star
ユーザー Hydrogen332
提出日時 2025-03-24 00:44:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 3,815 ms
コンパイル使用メモリ 285,004 KB
実行使用メモリ 16,164 KB
最終ジャッジ日時 2025-03-24 00:44:45
合計ジャッジ時間 9,990 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()

const ll INF = 1ll << 60;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int N;
    ll S;
    cin >> N >> S;
    vector<pair<ll, int>> P(N);
    rep(i, 0, N) {
        cin >> P[i].first;
        P[i].second = i;
    }
    P.push_back({-INF, -1});
    P.push_back({INF, -1});
    sort(all(P));
    
    set<int> ans;
    rep(i, 1, N + 1) {
        if (P[i].first - P[i - 1].first > S && P[i + 1].first - P[i].first > S) ans.insert(P[i].second + 1);
    }
    
    cout << ans.size() << '\n';
    for (int t : ans) cout << t << ' ';
    cout << '\n';
}
0