結果
問題 | No.2803 Bocching Star |
ユーザー |
![]() |
提出日時 | 2024-07-19 19:47:50 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 70 ms / 2,000 ms |
コード長 | 1,982 bytes |
コンパイル時間 | 6,121 ms |
コンパイル使用メモリ | 285,212 KB |
実行使用メモリ | 6,012 KB |
最終ジャッジ日時 | 2024-07-19 19:48:00 |
合計ジャッジ時間 | 8,812 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using u32 = unsigned int;using u64 = unsigned long long;using i128 = __int128;using u128 = unsigned __int128;using f128 = __float128;template<typename T>bool chmax(T& a, const T& b) {bool res = a < b;a = max(a, b);return res;}template<typename T>bool chmin(T& a, const T& b){bool res = a > b;a = min(a, b);return res;}typedef vector<long long> vl;typedef pair<ll,ll> pll;typedef vector<pair<ll, ll>> vll;typedef vector<int> vi;typedef vector<pair<int,int>> vii;typedef pair<int,int> pii;const int inf = 1000000009;const ll linf = 4000000000000000009;// https://trap.jp/post/1224/template<class... T>void input(T&... a){(cin >> ... >> a);}void print(){cout << '\n';}template<class T, class... Ts>void print(const T& a, const Ts&... b){cout << a;(cout << ... << (cout << ' ', b));cout << '\n';}#define rep1(a) for(int i = 0; i < a; i++)#define rep2(i, a) for(int i = 0; i < a; i++)#define rep3(i, a, b) for(int i = a; i < b; i++)#define rep4(i, a, b, c) for(int i = a; i < b; i += c)#define overload4(a, b, c, d, e, ...) e#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)#define eb emplace_back#define mp make_pair#define mt make_tuple#define fi first#define se second//---------------------------------void solve(){int n, s; cin >> n >> s;vii a(n);rep(i, n) cin >> a[i].fi, a[i].se=i+1;sort(a.begin(), a.end());vi ans;rep(i, n){bool f = true;if(i > 0 && a[i].fi-a[i-1].fi <= s) f = false;if(i < n-1 && a[i+1].fi-a[i].fi <= s) f = false;if(f)ans.push_back(a[i].se);}print(ans.size());sort(ans.begin(), ans.end());for(int v: ans) cout << v << " ";}int main(){ios::sync_with_stdio(false);cin.tie(0);int t = 1;//cin >> t;rep(i,0,t) solve();}