結果
問題 | No.2803 Bocching Star |
ユーザー |
![]() |
提出日時 | 2024-07-12 22:11:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 290 ms / 2,000 ms |
コード長 | 1,153 bytes |
コンパイル時間 | 4,341 ms |
コンパイル使用メモリ | 239,940 KB |
実行使用メモリ | 20,312 KB |
最終ジャッジ日時 | 2024-07-12 22:11:41 |
合計ジャッジ時間 | 11,058 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;#define rep(i,n) for(int i = 0; i < n; i++)#define all(a) a.begin(),a.end()#define SORT(a) sort(all(a));#define MIN(a) *min_element(all(a))#define MAX(a) *max_element(all(a))#define SUM(a) accumulate(all(a),0LL)using ll=long long;using ld=long double;using ull=unsigned long;ll MOD=998244353;using mint = static_modint<998244353>;const int dx[]={0,1,0,-1,1,-1,1,-1};const int dy[]={1,0,-1,0,1,1,-1,-1};const string ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZ";const string alpha="abcdefghijklmnopqrstuvwxyz";int main(){cin.tie(nullptr);cout.tie(nullptr);ios::sync_with_stdio(false);ll n,s;cin>>n>>s;vector<ll>p(n);map<ll,ll>mp;rep(i,n){cin>>p[i];mp[p[i]]=i;}SORT(p);vector<ll>ans(0);rep(i,n){auto Iter1 = upper_bound(all(p), p[i]+s);auto Iter2 = upper_bound(all(p), p[i]-s-1);if(Iter1-Iter2==1){ans.push_back(p[i]);}}cout<<ans.size()<<endl;ll c=ans.size();vector<ll>ans2(c);for(ll i=0;i<c;i++){ans2[i]=mp[ans[i]]+1;}SORT(ans2);rep(i,c){cout<<ans2[i]<<" ";}}