結果
| 問題 |
No.2803 Bocching Star
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-12 21:32:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 945 bytes |
| コンパイル時間 | 2,444 ms |
| コンパイル使用メモリ | 202,540 KB |
| 最終ジャッジ日時 | 2025-02-22 03:37:32 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,S;
cin>>N>>S;
vector<int>P(N);
vector<pair<int,int>>vp;
for(int i=0;i<N;i++){
cin>>P[i];
vp.push_back(make_pair(P[i],i));
}
sort(all(vp));
vector<int>id(N);
for(int i=0;i<N;i++)id[vp[i].second]=i;
vector<int>ans;
for(int i=0;i<N;i++){
bool ok=false;
if(id[i]>0&&vp[id[i]-1].first>=P[i]-S)ok=true;
if(id[i]<N-1&&vp[id[i]+1].first<=P[i]+S)ok=true;
if(!ok)ans.push_back(i+1);
}
cout<<(int)ans.size()<<"\n";
for(auto x:ans)cout<<x<<" ";
cout<<"\n";
}