結果
問題 |
No.2803 Bocching Star
|
ユーザー |
|
提出日時 | 2024-07-12 22:54:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 470 ms / 2,000 ms |
コード長 | 672 bytes |
コンパイル時間 | 2,905 ms |
コンパイル使用メモリ | 207,008 KB |
最終ジャッジ日時 | 2025-02-22 04:57:17 |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int n,s; cin >> n >> s; vector<int> p(n); for(int i = 0;i < n;i++) cin >> p[i]; auto t = p; sort(t.begin(),t.end()); map<int,int> m; for(int i = 0;i < n;i++) m[p[i]]++; vector<int> count; for(int i = 0;i < n;i++){ if(m[p[i]] > 1) continue; int k = lower_bound(t.begin(),t.end(),p[i]) - t.begin(); bool b = false; if(!(k + 1 == n)){ if(s >= abs(t[k] - t[k + 1])){ b = true; } } if(!(k - 1 == -1)){ if(s >= abs(t[k] - t[k - 1])){ b = true; } } if(!b) count.emplace_back(i); } cout << count.size() << endl; for(auto to : count) cout << to + 1 << ' '; cout << endl; }