結果
問題 |
No.2803 Bocching Star
|
ユーザー |
![]() |
提出日時 | 2024-07-13 00:14:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 137 ms / 2,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 3,487 ms |
コンパイル使用メモリ | 257,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-13 00:14:46 |
合計ジャッジ時間 | 7,964 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n, s; cin >> n >> s; vector<pair<int, int>> p(n); rep(i, n) cin >> p[i].first, p[i].second = i; sort(p.begin(), p.end()); vector<int> ans(0); rep(i, n) { bool isIsolated = true; if (i > 0) { if (p[i].first - p[i - 1].first <= s) isIsolated = false; } if (i + 1 < n) { if (p[i + 1].first - p[i].first <= s) isIsolated = false; } if (isIsolated) ans.push_back(p[i].second); } sort(ans.begin(), ans.end()); cout << ans.size() << endl; for (auto a : ans) cout << a + 1 << " "; cout << endl; return 0; }