結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー HIcoderHIcoder
提出日時 2024-09-05 21:50:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,213 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 122,900 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-05 21:50:50
合計ジャッジ時間 5,450 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 AC 16 ms
6,944 KB
testcase_03 AC 6 ms
6,944 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 5 ms
6,948 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 5 ms
6,944 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 3 ms
6,944 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 19 ms
6,944 KB
testcase_22 AC 670 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

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