結果
| 問題 | 
                            No.2845 Birthday Pattern in Two Different Calendars
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-08-23 21:48:53 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,874 bytes | 
| コンパイル時間 | 1,485 ms | 
| コンパイル使用メモリ | 168,332 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-08-23 21:49:00 | 
| 合計ジャッジ時間 | 5,696 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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) {
                        cnt += 1;
                        if (cnt == n) {
                            cout << now << endl;
                            break;
                        } else {
                            cout << now << " ";
                        }
                    }
                    now += (m-1);
                    if (now > k) {
                        now -= k;
                    }
                    tmp += 1;
                    if (now == i) {
                        break;
                    }
                }
                if(cnt == n) {
                    break;
                }
            }
            cout << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}