結果
| 問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
| コンテスト | |
| ユーザー |
n0ma_ru
|
| 提出日時 | 2024-08-23 21:53:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 374 ms / 2,000 ms |
| コード長 | 1,132 bytes |
| コンパイル時間 | 2,193 ms |
| コンパイル使用メモリ | 195,248 KB |
| 最終ジャッジ日時 | 2025-02-23 23:42:37 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define dbg(x) cerr << #x << ": " << (x) << endl;
template<class F, class S>
ostream& operator<<(ostream& os, pair<F,S>& p) {
os << '(' << p.first << ',' << p.second << ')';
return os;
}
template<class Iter>
void print(Iter beg, Iter end) {
for (Iter itr = beg; itr != end; ++itr) {
cerr << *itr << ' ';
}
cerr << '\n';
}
inline bool naraba(bool a, bool b) { return (!a || b); }
int N,M,K;
void solve() {
cin >> K >> M >> N;
int D = gcd(K,M-1);
int cnt = K/D/2 * D;
if (cnt >= N) {
cout << "Yes\n";
int now = 0;
vector<int> ans;
for (int i = 0; i < K/D/2; ++i) {
ans.push_back(now);
now = (now + M-1) % K;
now = (now + M-1) % K;
}
for (int i = 0; i < N; ++i) {
int x = ans[i % ans.size()] + (i/ans.size()) + 1;
cout << x << " \n"[i==N-1];
}
} else {
cout << "No\n";
}
}
int main() {
int T;
cin >> T;
while (T--) {
solve();
}
}
n0ma_ru