結果
問題 | No.2803 Bocching Star |
ユーザー |
![]() |
提出日時 | 2024-07-12 21:11:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 1,288 bytes |
コンパイル時間 | 1,279 ms |
コンパイル使用メモリ | 115,552 KB |
最終ジャッジ日時 | 2025-02-22 03:20:31 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <algorithm>#include <cassert>#include <cmath>#include <cstring>#include <iomanip>#include <iostream>#include <map>#include <queue>#include <set>#include <tuple>#include <utility>#include <vector>using namespace std;using i8 = int8_t;using i32 = int;using i64 = long long;// using i128 = __int128;using u64 = unsigned long long;using ll = long long;void _main();int main() {cin.tie(0);ios::sync_with_stdio(false);_main();}i64 pow(i64 j, i64 n) {i64 res = 1;while (n > 0) {if (n & 1)res *= j;j *= j;n >>= 1;}return res;}i64 n, s;void _main() {cin >> n >> s;vector<pair<i64, i64>> p(n);for (i64 i = 0; i < n; i++) {cin >> p[i].first;p[i].second = i;}sort(p.begin(), p.end());vector<i64> ans;for (i64 i = 0; i < n; i++) {i64 f = lower_bound(p.begin(), p.end(), make_pair(p[i].first - s, 0ll)) -p.begin();i64 b =upper_bound(p.begin(), p.end(), make_pair(p[i].first + s, 1ll << 60)) -p.begin() - 1;if (f == i && b == i) {ans.push_back(p[i].second);}}sort(ans.begin(), ans.end());cout << ans.size() << "\n";for (i64 i = 0; i < ans.size(); i++) {cout << ans[i] + 1 << (i + 1 == ans.size() ? "\n" : " ");}}