結果

問題 No.2803 Bocching Star
ユーザー haihamabossuhaihamabossu
提出日時 2024-07-12 22:09:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 2,676 ms
コンパイル使用メモリ 212,572 KB
実行使用メモリ 8,600 KB
最終ジャッジ日時 2024-07-12 22:10:35
合計ジャッジ時間 5,323 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 9 ms
5,376 KB
testcase_04 AC 44 ms
6,528 KB
testcase_05 AC 22 ms
5,376 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 18 ms
5,376 KB
testcase_08 AC 10 ms
5,376 KB
testcase_09 AC 41 ms
6,272 KB
testcase_10 AC 50 ms
6,656 KB
testcase_11 AC 54 ms
7,100 KB
testcase_12 AC 18 ms
5,376 KB
testcase_13 AC 38 ms
6,144 KB
testcase_14 AC 25 ms
5,376 KB
testcase_15 AC 57 ms
7,176 KB
testcase_16 AC 31 ms
5,788 KB
testcase_17 AC 10 ms
5,376 KB
testcase_18 AC 7 ms
5,376 KB
testcase_19 AC 40 ms
6,272 KB
testcase_20 AC 26 ms
5,376 KB
testcase_21 AC 19 ms
5,376 KB
testcase_22 AC 23 ms
5,376 KB
testcase_23 AC 53 ms
7,040 KB
testcase_24 AC 71 ms
8,476 KB
testcase_25 AC 66 ms
8,480 KB
testcase_26 AC 68 ms
8,476 KB
testcase_27 AC 57 ms
7,416 KB
testcase_28 AC 66 ms
7,452 KB
testcase_29 AC 50 ms
7,068 KB
testcase_30 AC 66 ms
8,476 KB
testcase_31 AC 51 ms
6,940 KB
testcase_32 AC 73 ms
8,600 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void solve() {
  ll n, s;
  cin >> n >> s;
  vector<pair<ll, ll>> p(n);
  rep(i, n) cin >> p[i].first, p[i].second = i;
  sort(p.begin(), p.end());
  vector<ll> ans;
  rep(i, n) {
    bool ok = false;
    if (i > 0)
      ok |= p[i].first - p[i - 1].first <= s;
    if (i < n - 1)
      ok |= p[i + 1].first - p[i].first <= s;
    if (!ok)
      ans.push_back(p[i].second + 1);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << '\n';
  rep(i, ans.size()) cout << (i ? " " : "") << ans[i];
  cout << '\n';
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int T = 1;
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
0