結果
問題 | No.2803 Bocching Star |
ユーザー |
|
提出日時 | 2024-07-20 22:56:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 151 ms / 2,000 ms |
コード長 | 851 bytes |
コンパイル時間 | 2,504 ms |
コンパイル使用メモリ | 204,452 KB |
最終ジャッジ日時 | 2025-02-23 17:22:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
// author - v1kash#include <bits/stdc++.h>using namespace std;int main(){#ifndef ONLINE_JUDGEfreopen("input.txt","r",stdin);freopen("output.txt","w",stdout);#endiflong n,s;cin>>n>>s;if(n==1){int p;cin>>p;cout<<1<<'\n';cout<<1;return 0;}vector<pair<long,long>> v(n);vector<pair<long,long>> ans;for(int i=0;i<n;i++) {cin>>v[i].first;v[i].second=i+1;}// 1 3 6 10 s=2sort(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(), [](auto &left, auto &right) {return left.second < right.second;});cout<<ans.size()<<'\n';for(int i=0;i<ans.size();i++){cout<<ans[i].second<<" ";}}