結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー risujirohrisujiroh
提出日時 2024-08-23 21:57:22
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,710 bytes
コンパイル時間 3,126 ms
コンパイル使用メモリ 256,120 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-23 21:57:28
合計ジャッジ時間 6,216 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 AC 10 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 3 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 10 ms
6,940 KB
testcase_22 AC 69 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#if __INCLUDE_LEVEL__ == 0

#include __BASE_FILE__

void Solve() {
  int m, d, n;
  IN(m, d, n);
  --d;
  bool f = SetMin(d, m - d);
  if (d == 0) {
    OUT("No");
    return;
  }
  vector<int> ans;
  for (int s = 0; s < m; s += 2 * d) {
    for (int i = s; i < s + d && i + d < m; ++i) {
      ans.push_back(f ? m - i : i + 1);
    }
  }
  if (Sz(ans) < n) {
    OUT("No");
  } else {
    ans.resize(n);
    OUT("Yes");
    OUT(ans);
  }
}

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

  int t;
  IN(t);
  while (t--) {
    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) {
  apply([&](auto&... xs) { (is >> ... >> xs); }, t);
  return is;
}

ostream& operator<<(ostream& os, Range auto&& r) {
  auto sep = "";
  for (auto&& e : r) os << exchange(sep, " ") << e;
  return os;
}
ostream& operator<<(ostream& os, Tuple auto&& t) {
  auto sep = "";
  apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t);
  return os;
}

}  // namespace std

using namespace std;

#define LAMBDA2(x, y, ...) [&](auto&& x, auto&& y) -> decltype(auto) { return __VA_ARGS__; }
#define Sz(r) int(size(r))
#define SetMin(...) LAMBDA2(x, y, y < x && (x = y, 1))(__VA_ARGS__)
#define IN(...) cin >> forward_as_tuple(__VA_ARGS__)
#define OUT(...) cout << forward_as_tuple(__VA_ARGS__) << '\n'

#endif  // __INCLUDE_LEVEL__ == 1
0