結果
| 問題 |
No.2803 Bocching Star
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-12 21:02:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 2,000 ms |
| コード長 | 802 bytes |
| コンパイル時間 | 2,103 ms |
| コンパイル使用メモリ | 204,552 KB |
| 最終ジャッジ日時 | 2025-02-22 03:14:16 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N,S; cin >> N >> S;
vector<pair<int,int>> A(N);
for(int i=0; i<N; i++){
int p; cin >> p;
A.at(i) = {p,i};
}
sort(A.begin(),A.end());
vector<int> answer;
for(int i=0; i<N; i++){
auto [a,pos] = A.at(i);
bool ok = true;
if(i){
auto [a2,ig] = A.at(i-1);
if(abs(a-a2) <= S) ok = false;
}
if(i != N-1){
auto [a2,ig] = A.at(i+1);
if(abs(a-a2) <= S) ok = false;
}
if(ok) answer.push_back(pos);
}
sort(answer.begin(),answer.end());
cout << answer.size() << endl;
for(auto &a : answer) cout << a+1 << " "; cout << endl;
}