結果
| 問題 |
No.2803 Bocching Star
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-28 15:20:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,478 bytes |
| コンパイル時間 | 2,441 ms |
| コンパイル使用メモリ | 201,184 KB |
| 最終ジャッジ日時 | 2025-02-24 13:56:42 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 35 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define RIDLs_code ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fi1(x) for(int i=1;i<=x;++i)
#define fi0(x) for(int i=0;i<x;++i)
#define fj0(x) for(int j=0;j<x;++j)
#define fj1(x) for(int j=1;j<=x;++j)
#define For(elem, begin, end) for(int elem=begin;elem<end;++elem)
#define RFor(elem, begin, end) for(int elem=begin;elem>=end;--elem)
#define all(x) (x).begin(), (x).end()
#define pb push_back
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
bool is[200005]={false};
bool cmp(pair<ll, ll> a, pair<ll, ll> b)
{
return a.first<b.first;
}
void solve(){
int n, s, cnt=0;
cin>>n>>s;
vector<pair<ll, ll>> a;
ll pos, ind;
fi1(n){
cin>>pos;
a.push_back(make_pair(pos, i));
}
sort(all(a), cmp);
fi0(n){
if(i==0){
if(a[i+1].first-a[i].first>s){
is[a[i].second]=true;
cnt++;
}
}
else if(i==n-1){
if(a[i].first-a[i-1].first>s){
is[a[i].second]=true;cnt++;}
}
else{
if(a[i].first-a[i-1].first>s && a[i+1].first-a[i].first>s){
is[a[i].second]=true;cnt++;}
}
}
cout<<cnt<<endl;
fi1(n){
if(is[i]) cout<<i<<" ";
}
return;
}
int main(){
RIDLs_code
int T=1;
// cin>>T;
while (T--) solve();
return 0;
}
vjudge1