結果

問題 No.2803 Bocching Star
ユーザー coco0715coco0715
提出日時 2024-07-12 21:58:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 1,342 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 177,012 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-12 21:58:56
合計ジャッジ時間 7,265 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 18 ms
6,944 KB
testcase_04 AC 125 ms
6,940 KB
testcase_05 AC 67 ms
6,944 KB
testcase_06 AC 13 ms
6,940 KB
testcase_07 AC 49 ms
6,940 KB
testcase_08 AC 27 ms
6,940 KB
testcase_09 AC 139 ms
6,940 KB
testcase_10 AC 143 ms
6,940 KB
testcase_11 AC 142 ms
6,940 KB
testcase_12 AC 42 ms
6,940 KB
testcase_13 AC 117 ms
6,940 KB
testcase_14 AC 78 ms
6,940 KB
testcase_15 AC 136 ms
6,944 KB
testcase_16 AC 72 ms
6,940 KB
testcase_17 AC 24 ms
6,944 KB
testcase_18 AC 19 ms
6,940 KB
testcase_19 AC 119 ms
6,944 KB
testcase_20 AC 71 ms
6,944 KB
testcase_21 AC 55 ms
6,944 KB
testcase_22 AC 54 ms
6,940 KB
testcase_23 AC 149 ms
6,940 KB
testcase_24 AC 161 ms
6,944 KB
testcase_25 AC 157 ms
6,944 KB
testcase_26 AC 158 ms
6,944 KB
testcase_27 AC 152 ms
6,940 KB
testcase_28 AC 153 ms
6,944 KB
testcase_29 AC 150 ms
6,944 KB
testcase_30 AC 160 ms
6,944 KB
testcase_31 AC 149 ms
6,940 KB
testcase_32 AC 159 ms
6,940 KB
testcase_33 AC 3 ms
6,940 KB
testcase_34 AC 3 ms
6,940 KB
testcase_35 AC 3 ms
6,944 KB
testcase_36 AC 3 ms
6,940 KB
testcase_37 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph = vector<vector<int>>;
#define yes (cout<<"Yes"<<endl)
#define no (cout<<"No"<<endl)
#define Endl endl
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(v) sort(v.begin(),v.end());
#define rev(v) reverse(v.begin(),v.end());
#define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() );

ll INF=9223372036800000000;
int inf=200000000;
ll mod=998244353;
ll mod2=1000000007;
int dx[8]={-1,-1,-1,0,0,1,1,1};
int dy[8]={-1,0,1,-1,1,-1,0,1};
int dtt[4]={1,3,4,6};//dx,dyを4方向にする
ll two_billion=2000000000000;
int ohm=100000000;
string alpha="abcdefghijklmnopqrstuvwxyz";


int main(){
    int n;cin>>n;
    int k;cin>>k;
    vector<int> p(n);
    set<int> s;
    rep(i,n){
        cin>>p[i];
    }
    vector<int> b=p;
    Sort(b);
    vector<int> ans;
    for(int i=0;i<n;i++){
        int l=max(0,p[i]-k),r=p[i]+k;
        int p=lower_bound(b.begin(),b.end(),l)-b.begin();
        int q=upper_bound(b.begin(),b.end(),r)-b.begin();
        q--;
        if(p-q==0){
            ans.push_back(i+1);
        }
        //cout<<p<<' '<<q<<' '<<q-p<<endl;
    }
    cout<<ans.size()<<endl;
    for(int i:ans){
        cout<<i<<' ';
    }cout<<endl;
}
0