結果
問題 |
No.2803 Bocching Star
|
ユーザー |
![]() |
提出日時 | 2024-07-12 21:27:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 148 ms / 2,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 2,249 ms |
コンパイル使用メモリ | 204,588 KB |
最終ジャッジ日時 | 2025-02-22 03:34:35 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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(n); for (int i = 0; i < n; i++) { cin >> p[i].first; p[i].second = i; } sort(p.begin(), p.end()); vector<int> ans; for (int i = 0; i < n; i++) { bool ok = true; if (i - 1 >= 0 and p[i].first - p[i - 1].first <= s) ok = false; if (i + 1 < n and p[i + 1].first - p[i].first <= s) ok = false; if (ok) ans.push_back(p[i].second + 1); } cout << ans.size() << endl; sort(ans.begin(), ans.end()); for (int i = 0; i < ans.size(); i++) { cout << ans[i] << (i + 1 == ans.size() ? "\n" : " "); } }