結果
| 問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-23 21:43:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,726 bytes |
| コンパイル時間 | 1,686 ms |
| コンパイル使用メモリ | 167,440 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-23 21:43:57 |
| 合計ジャッジ時間 | 5,687 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, a, b) for(ll i = a; i < b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)
constexpr ll inf = 4e18;
struct SetupIO {
SetupIO() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(30);
}
} setup_io;
using dd = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<dd>;
using vvd = vector<vd>;
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a%b);
}
int main(void) {
ll t;cin>>t;
rep(i,0,t) {
ll k,m,n;cin>>k>>m>>n;
if (m == 1) {
cout << "No" << endl;
continue;
}
ll g = gcd(k, m-1);
ll Loop_Size = k / g;
ll Loop_Num = g;
ll n_per_Loop = Loop_Size / 2;
ll max_n = n_per_Loop * Loop_Num;
if (max_n >= n) {
cout << "Yes" << endl;
ll cnt = 0;
rep(i,1,g+1) {
ll now = i;
ll tmp = 0;
while(true) {
if (tmp % 2 == 0) {
cout << now << " ";
cnt += 1;
if(cnt == n) {
break;
}
}
now += (m-1);
now %= k;
tmp += 1;
if (now == i) {
break;
}
}
if(cnt == n) {
break;
}
}
cout << endl;
} else {
cout << "No" << endl;
}
}
return 0;
}