結果
| 問題 | 
                            No.2845 Birthday Pattern in Two Different Calendars
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-08-23 21:39:11 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 808 bytes | 
| コンパイル時間 | 2,086 ms | 
| コンパイル使用メモリ | 199,316 KB | 
| 最終ジャッジ日時 | 2025-02-23 23:35:34 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 7 WA * 15 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int T; cin >> T;
    while(T--){
        int K,M,N; cin >> K >> M >> N;
        if(M == 1 || N*2 > K){cout << "No\n"; continue;}
        vector<int> B(K);
        for(int i=0; i<K; i++) B.at(i) = (i+M-1)%K;
        vector<bool> ng(K);
        vector<int> answer;
        for(int i=0; i<K; i++){
            if(ng.at(i) || ng.at(B.at(i))) continue;
            answer.push_back(i);
            ng.at(i) = true; ng.at(B.at(i)) = true;
        }
        while(answer.size() > N) answer.pop_back();
        if(answer.size() < N) cout << "No\n";
        else{
            cout << "Yes\n";
            for(int i=0; i<N; i++) cout << answer.at(i)+1 << (i==N-1?"\n":" ");
        }
    }
}