結果
問題 |
No.2803 Bocching Star
|
ユーザー |
|
提出日時 | 2024-09-04 10:55:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 2,397 ms |
コンパイル使用メモリ | 205,196 KB |
最終ジャッジ日時 | 2025-02-24 03:52:15 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll N,S; cin>>N>>S; vector<pair<ll,ll>> P(N); for(int i=0;i<N;i++){ cin>>P[i].first; P[i].second=i; } sort(P.begin(),P.end()); vector<int> AN; for(int i=0;i<N;i++){ bool OK=1; if(i!=0&&P[i].first-P[i-1].first<=S)OK=0; if(i!=N-1&&P[i+1].first-P[i].first<=S)OK=0; if(OK)AN.push_back(P[i].second); } sort(AN.begin(),AN.end()); ll an=AN.size(); cout<<an<<endl; for(int i=0;i<an;i++)cout<<AN[i]+1<<" \n"[i==an-1]; }