結果
| 問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2024-08-23 22:03:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,781 bytes |
| コンパイル時間 | 2,793 ms |
| コンパイル使用メモリ | 260,244 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-23 22:03:50 |
| 合計ジャッジ時間 | 8,004 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 RE * 21 |
ソースコード
#if __INCLUDE_LEVEL__ == 0
#include __BASE_FILE__
void Solve() {
int m, d, n;
IN(m, d, n);
--d;
if (d == 0) {
OUT("No");
return;
}
vector<int> ans;
vector<bool> used(n);
for (int s : Rep(0, n)) {
if (used[s]) {
continue;
}
vector<int> tmp;
int i = s;
do {
used[i] = true;
tmp.push_back(i);
i = (i + d) % m;
} while (i != s);
for (int i : Rep(0, Sz(tmp) / 2)) {
ans.push_back(tmp[2 * 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 Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__)
#define Sz(r) int(size(r))
#define IN(...) cin >> forward_as_tuple(__VA_ARGS__)
#define OUT(...) cout << forward_as_tuple(__VA_ARGS__) << '\n'
#endif // __INCLUDE_LEVEL__ == 1
risujiroh