結果
問題 | No.2803 Bocching Star |
ユーザー | ooaiu |
提出日時 | 2024-07-18 11:38:51 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.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 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#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; }