結果
| 問題 |
No.2803 Bocching Star
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-12 21:52:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 981 bytes |
| コンパイル時間 | 4,779 ms |
| コンパイル使用メモリ | 256,420 KB |
| 最終ジャッジ日時 | 2025-02-22 03:54:03 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
using mint = atcoder::modint1000000007;
int main(){
int n,s;
cin>>n>>s;
vector<int> p(n);
rep(i,0,n) cin>>p.at(i);
vector<int> q(n);
iota(q.begin(),q.end(),0);
sort(q.begin(),q.end(),[&](int i,int j){return p.at(i)<p.at(j);});
vector<int> ans;
rep(i,0,n){
int flg=0;
if(i>0&&p.at(q.at(i-1))+s>=p.at(q.at(i))) flg=1;
if(i<n-1&&p.at(q.at(i))+s>=p.at(q.at(i+1))) flg=1;
if(!flg) ans.push_back(q.at(i));
}
sort(ans.begin(),ans.end());
cout<<ans.size()<<"\n";
for(int x:ans) cout<<x+1<<" ";
cout<<"\n";
}