結果
問題 |
No.2803 Bocching Star
|
ユーザー |
|
提出日時 | 2024-07-20 22:54:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 2,039 ms |
コンパイル使用メモリ | 201,552 KB |
最終ジャッジ日時 | 2025-02-23 17:22:02 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | WA * 35 |
ソースコード
// author - v1kash #include <bits/stdc++.h> using namespace std; int main(){ long 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=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<<" "; } }