結果

問題 No.2803 Bocching Star
ユーザー ooaiuooaiu
提出日時 2024-07-18 11:38:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 3,031 bytes
コンパイル時間 6,282 ms
コンパイル使用メモリ 301,216 KB
実行使用メモリ 6,148 KB
最終ジャッジ日時 2024-07-18 11:39:02
合計ジャッジ時間 10,396 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 8 ms
5,376 KB
testcase_04 AC 46 ms
5,376 KB
testcase_05 AC 20 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 17 ms
5,376 KB
testcase_08 AC 9 ms
5,376 KB
testcase_09 AC 39 ms
5,376 KB
testcase_10 AC 43 ms
5,376 KB
testcase_11 AC 49 ms
5,376 KB
testcase_12 AC 17 ms
5,376 KB
testcase_13 AC 35 ms
5,376 KB
testcase_14 AC 24 ms
5,376 KB
testcase_15 AC 52 ms
5,376 KB
testcase_16 AC 29 ms
5,376 KB
testcase_17 AC 9 ms
5,376 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 AC 36 ms
5,376 KB
testcase_20 AC 23 ms
5,376 KB
testcase_21 AC 18 ms
5,376 KB
testcase_22 AC 20 ms
5,376 KB
testcase_23 AC 48 ms
5,376 KB
testcase_24 AC 65 ms
6,144 KB
testcase_25 AC 58 ms
6,020 KB
testcase_26 AC 60 ms
5,992 KB
testcase_27 AC 58 ms
5,504 KB
testcase_28 AC 55 ms
5,628 KB
testcase_29 AC 51 ms
5,376 KB
testcase_30 AC 63 ms
6,148 KB
testcase_31 AC 46 ms
5,376 KB
testcase_32 AC 65 ms
5,892 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

#ifdef LOCAL
#include "algo/debug.hpp"
#else
#define debug(...) void(0)
#endif

constexpr int inf=0x3fffffff;
constexpr long long linf=0xfffffffffffffff;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;

template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vc<T>>;
template <class T> using vvvc = vector<vvc<T>>;
template <class T> using vvvvc = vector<vvvc<T>>;
template <class T> using pq = priority_queue<T>; //max
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>; //min

#define len(x) int((x).size())

#define overload4(a,b,c,d,name,...) name
#define overload5(a,b,c,d,e,name,...) name

#define rep1(n) for(ll _=0;_<n;++_)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)

#define each1(i,a) for(auto&&i:a)
#define each2(x,y,a) for(auto&&[x,y]:a)
#define each3(x,y,z,a) for(auto&&[x,y,z]:a)
#define each4(w,x,y,z,a) for(auto&&[w,x,y,z]:a)
#define each(...) overload5(__VA_ARGS__,each4,each3,each2,each1)(__VA_ARGS__)

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend() 

#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define vv(type,name,h,...) vector<vector<type>> name(h,vector<type>(__VA_ARGS__))
#define vvv(type,name,h,w,...) vector<vector<vector<type>>> name(h,vector(w,vector<type>(__VA_ARGS__)))
#define vvvv(type, name, h, w, n, ...) vector<vector<vector<vector<type>>>> name(h, vector<vector<vector<type>>>(w, vector<vector<type>>(n, vector<type>(__VA_ARGS__))))

template <class T, class S> inline bool chmax(T& a, const S& b) { return (a < b ? a = b, 1 : 0); }
template <class T, class S> inline bool chmin(T& a, const S& b) { return (a > b ? a = b, 1 : 0); }
template <class T> void UNIQUE(T& a){ sort(all(a)); a.erase(unique(all(a)), a.end()); }
struct Setting{ Setting(){ cin.tie(nullptr)->sync_with_stdio(0); fixed(cout).precision(12); } }Setting;
//-----------------------------------

int main() {
    int N, S; cin >> N >> S;
    vector<pair<int, int>> P(N); rep(i, N) cin >> P[i].first, P[i].second = i + 1;
    if(N == 1) { cout << 1 << endl; cout << 1 << endl; return 0; }
    sort(all(P));
    vector<int> ans;
    rep(i, N) {
        if(i == 0) {
            if(P[i+1].first - P[i].first > S) ans.push_back(P[i].second);
        }else if(i == N - 1) {
            if(P[i].first - P[i-1].first > S) ans.push_back(P[i].second);
        }else {
            if(P[i + 1].first - P[i].first > S && P[i].first - P[i-1].first > S) ans.push_back(P[i].second);
        }
    }
    cout << len(ans) << endl;
    sort(all(ans));
    for(auto&&a: ans) {
        cout << a << " ";
    }cout << endl;
}
0