結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー HIcoder
提出日時 2024-09-05 21:50:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,213 bytes
コンパイル時間 1,091 ms
コンパイル使用メモリ 119,824 KB
最終ジャッジ日時 2025-02-24 03:53:47
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<queue>
#include<vector>
#include<cassert>
#include<random>
#include<set>
#include<map>
#include<cassert>
#include<unordered_map>
#include<bitset>
#include<numeric>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf=1<<30;
const ll INF=1LL<<62;
typedef pair<int,ll> P;
typedef pair<int,P> PP; 
const ll MOD=998244353;
const int dy[]={0,1,0,-1};
const int dx[]={1,0,-1,0};

void solve(){
    ll K,M,N;
    cin>>K>>M>>N;

    if(M==1 || K<N){
        cout<<"No"<<endl;
        return;
    }

    set<int> st;
    int c=2*N;
    int t=1;
    bool ok=true;
    vector<int> ans;
    vector<bool> used(K+1,false);
    for(int i=1;i<=K;i++){
        
        int x=(i+M-2)%K+1;

        if(used[i] || used[x]){
            continue;
        }
        ans.push_back(i);
        used[i]=1;
        used[x]=1;
        
    }

    if(ans.size()<N){
        ok=false;
    }

    if(!ok){
        cout<<"No"<<endl;

    }else{
        cout<<"Yes"<<endl;
        for(int i=0;i<N;i++){
            cout<<ans[i]<<" ";
        }
        cout<<endl;
    }
    return;
    
}
int main(){
    int T;
    cin>>T;
    for(int t=0;t<T;t++){
        solve();
    }
}
0