結果
問題 | No.2803 Bocching Star |
ユーザー |
|
提出日時 | 2024-07-13 20:07:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 741 bytes |
コンパイル時間 | 3,504 ms |
コンパイル使用メモリ | 204,936 KB |
最終ジャッジ日時 | 2025-02-22 06:31:47 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(0);int N, S;cin >> N >> S;vector<pair<int,int>> P(N + 2);vector<int> ans;P[N] = {2'000'000'001, -1};P[N + 1] = {-2'000'000'001, -1};for(int i = 0; i < N; i++){cin >> P[i].first;P[i].second = i + 1;}sort(P.begin(), P.end());for(int i = 1; i <= N; i++){auto &&[x, j] = P[i];if(P[i - 1].first + S < x && x < P[i + 1].first - S){ans.emplace_back(j);}}sort(ans.begin(), ans.end());cout << ans.size() << '\n';for(int i = 0; i < ans.size(); i++){cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' ');}}