結果
| 問題 |
No.2803 Bocching Star
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-20 22:42:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 649 bytes |
| コンパイル時間 | 2,076 ms |
| コンパイル使用メモリ | 201,108 KB |
| 最終ジャッジ日時 | 2025-02-23 17:21:51 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | WA * 35 |
ソースコード
// author - v1kash
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,s;
cin>>n>>s;
if(n==1){
int p;
cin>>p;
cout<<1;
return 0;
}
vector<pair<int,int>> v(n);
vector<pair<int,int>> ans;
for(int i=0;i<n;i++) {cin>>v[i].first;v[i].second=i+1;}
// 1 3 6 10 s=2
sort(v.begin(),v.end());
for(int i=1;i<v.size()-1;i++){
if(v[i].first-v[i-1].first>s && v[i+1].first-v[i].first>s) ans.push_back(v[i]);
}
if(v[n-1].first-v[n-2].first>s) ans.push_back(v[n-1]);
if(v[1].first-v[0].first>s)ans.push_back(v[0]);
sort(ans.begin(),ans.end());
cout<<ans.size()<<'\n';
for(int i=0;i<ans.size();i++){
cout<<ans[i].second<<" ";
}
}