結果
問題 | No.2803 Bocching Star |
ユーザー |
![]() |
提出日時 | 2024-08-05 12:36:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 146 ms / 2,000 ms |
コード長 | 755 bytes |
コンパイル時間 | 2,341 ms |
コンパイル使用メモリ | 204,540 KB |
最終ジャッジ日時 | 2025-02-23 21:02:37 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n, s; cin >> n >> s; vector<pair<int, int>> p; for (int i = 1; i <= n; i++) { int x; cin >> x; p.emplace_back(x, i); } sort(p.begin(), p.end()); vector<int> ans; for (int i = 0; i < n; i++) { int x = p[i].first; bool ok = false; if (i - 1 >= 0 && x - p[i - 1].first <= s) { ok = true; } if (i + 1 < n && p[i + 1].first - x <= s) { ok = true; } if (!ok) { ans.emplace_back(p[i].second); } } sort(ans.begin(), ans.end()); cout << ans.size() << endl; for (int x : ans) { cout << x << " "; } cout << endl; }