結果

問題 No.2836 Comment Out
ユーザー risujirohrisujiroh
提出日時 2024-08-09 21:42:13
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,030 bytes
コンパイル時間 2,793 ms
コンパイル使用メモリ 259,248 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-09 21:42:22
合計ジャッジ時間 5,168 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 12 ms
6,944 KB
testcase_08 AC 13 ms
6,940 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 26 ms
6,948 KB
testcase_15 AC 25 ms
6,944 KB
testcase_16 AC 25 ms
6,944 KB
testcase_17 WA -
testcase_18 AC 26 ms
6,944 KB
testcase_19 WA -
testcase_20 AC 25 ms
6,940 KB
testcase_21 AC 26 ms
6,944 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 12 ms
6,944 KB
testcase_25 AC 17 ms
6,940 KB
testcase_26 AC 8 ms
6,940 KB
testcase_27 AC 20 ms
6,940 KB
testcase_28 WA -
testcase_29 AC 16 ms
6,940 KB
testcase_30 AC 11 ms
6,940 KB
testcase_31 AC 16 ms
6,940 KB
testcase_32 WA -
testcase_33 AC 11 ms
6,944 KB
testcase_34 AC 8 ms
6,940 KB
testcase_35 AC 22 ms
6,944 KB
testcase_36 WA -
testcase_37 AC 20 ms
6,940 KB
testcase_38 AC 15 ms
6,940 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 17 ms
6,940 KB
testcase_42 WA -
testcase_43 AC 6 ms
6,940 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 WA -
testcase_46 AC 2 ms
6,940 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 2 ms
6,940 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 1 ms
6,940 KB
testcase_55 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#if __INCLUDE_LEVEL__ == 0

#include __BASE_FILE__

void Solve() {
  int n;
  IN(n);
  vector<int> a(n);
  IN(a);
  vector<int> f(n + 1);
  for (int i : Rep(n)) {
    if (a[i] >= 2) {
      int l = max(i - a[i] + 2, 0);
      int r = min(i + a[i] - 1, n);
      ++f[l];
      --f[r];
    }
  }
  partial_sum(f.begin(), f.end(), f.begin());
  OUT(ranges::count(f | take(n), 0) ? "Yes" : "No");
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  Solve();
}

#elif __INCLUDE_LEVEL__ == 1

#include <bits/stdc++.h>

template <class T> concept Range = std::ranges::range<T> && !std::convertible_to<T, std::string_view>;
template <class T> concept Tuple = std::__is_tuple_like<T>::value && !Range<T>;

namespace std {

istream& operator>>(istream& is, Range auto&& r) {
  for (auto&& e : r) {
    is >> e;
  }
  return is;
}

istream& operator>>(istream& is, Tuple auto&& t) {
  return apply([&](auto&... xs) -> istream& { return (is >> ... >> xs); }, t);
}

ostream& operator<<(ostream& os, Range auto&& r) {
  for (string_view sep = ""; auto&& e : r) {
    os << exchange(sep, " ") << e;
  }
  return os;
}

ostream& operator<<(ostream& os, Tuple auto&& t) {
  return apply([&](auto&... xs) -> ostream& {
    [[maybe_unused]] string_view sep = "";
    ((os << exchange(sep, " ") << xs), ...);
    return os; }, t);
}

}  // namespace std

#define DEF_INC_OR_DEC(op) \
  auto& operator op(Tuple auto&&); \
  auto& operator op(Range auto&& r) { \
    for (auto&& e : r) { \
      op e; \
    } \
    return r; \
  } \
  auto& operator op(Tuple auto&& t) { \
    std::apply([](auto&... xs) { (op xs, ...); }, t); \
    return t; \
  }

DEF_INC_OR_DEC(++)
DEF_INC_OR_DEC(--)

#undef DEF_INC_OR_DEC

#define IN(...) cin >> forward_as_tuple(__VA_ARGS__)
#define OUT(...) cout << forward_as_tuple(__VA_ARGS__) << '\n'

using namespace std;

using views::filter, views::transform, views::take, views::drop;

constexpr auto Rev = views::reverse;

constexpr auto Rep(int l, int r) { return views::iota(min(l, r), r); }
constexpr auto Rep(int n) { return Rep(0, n); }
constexpr auto Rep1(int l, int r) { return Rep(l, r + 1); }
constexpr auto Rep1(int n) { return Rep(1, n + 1); }

constexpr auto DivFloor(auto x, auto y) { return x / y - ((x ^ y) < 0 && x % y != 0); }
constexpr auto DivCeil(auto x, auto y) { return x / y + (0 <= (x ^ y) && x % y != 0); }
constexpr auto Floor(auto x, auto y) { return DivFloor(x, y) * y; }
constexpr auto Floor(auto x, auto y, auto z) { return Floor(x - z, y) + z; }
constexpr auto Ceil(auto x, auto y) { return DivCeil(x, y) * y; }
constexpr auto Ceil(auto x, auto y, auto z) { return Ceil(x - z, y) + z; }
constexpr auto Mod(auto x, auto y) { return x - Floor(x, y); }

template <class T, class U = T> bool SetMin(T& x, U&& y) { return y < x && (x = forward<U>(y), true); }
template <class T, class U = T> bool SetMax(T& x, U&& y) { return x < y && (x = forward<U>(y), true); }

constexpr int INF = INT_MAX / 2;
constexpr int64_t INF64 = INT64_MAX / 2;

#endif  // __INCLUDE_LEVEL__ == 1
0