結果
問題 | No.2803 Bocching Star |
ユーザー |
|
提出日時 | 2024-07-12 21:47:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 269 ms / 2,000 ms |
コード長 | 982 bytes |
コンパイル時間 | 2,128 ms |
コンパイル使用メモリ | 199,092 KB |
最終ジャッジ日時 | 2025-02-22 03:49:19 |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) template<typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template<typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } void solve(); int main() { cin.tie(nullptr)->sync_with_stdio(false); cout << fixed << setprecision(20); int t = 1; //cin >> t; while (t--) { solve(); } } int N,S,P[2<<17]; multiset<int>st; void solve() { cin>>N>>S; rep(i,N)cin>>P[i]; rep(i,N)st.insert(P[i]); vector<int>ans; rep(i,N){ bool flag=1; auto it=st.lower_bound(P[i]); if(it!=st.begin()){ --it; if(P[i]-*it<=S)flag=0; ++it; } ++it; if(it!=st.end()){ if(*it-P[i]<=S)flag=0; } if(flag)ans.emplace_back(i); } cout<<ans.size()<<endl; rep(i,ans.size())cout<<ans[i]+1<<" \n"[i+1==(int)ans.size()]; }