結果
| 問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
| コンテスト | |
| ユーザー |
Andrew8128
|
| 提出日時 | 2024-08-23 21:43:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 404 ms / 2,000 ms |
| コード長 | 1,471 bytes |
| コンパイル時間 | 4,932 ms |
| コンパイル使用メモリ | 313,700 KB |
| 実行使用メモリ | 22,272 KB |
| 最終ジャッジ日時 | 2024-08-23 21:43:52 |
| 合計ジャッジ時間 | 9,771 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
// 441_D.cpp 2024/08/23 21:26:46
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353, mod1 = 1000000007, inf = 1070000000;
const ll linf = 4610000000000000000;
#define REP(i,x,y) for (auto i = (x); i < (y); i++)
#define RREP(i,x,y) for (auto i = (y) - 1; (x) <= i; i--)
#define ALL(x) (x).begin(), (x).end()
template<class T> bool inr(const T &l, const T &x, const T &r){return (l<=x && x<r);}
template<class T> bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} else return 0;}
template<class T> bool chmin(T &a, const T &b){if(b < a){a = b; return 1;} else return 0;}
#include <atcoder/all>
using namespace atcoder;
#pragma GCC optimize("O3")
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while(T--){
int K,M,N;
cin >> K >> M >> N;
M--;
if(M == 0){
cout << "No" << '\n';
continue;
}
set<int> y,c;
set<int> done;
int j = 0;
while(ssize(y)<N && ssize(done) != K){
done.insert(j);
if(y.contains(j) || c.contains((j+M)%K) || y.contains((j+M)%K) || c.contains(j)){
j = (j+1)%K;
}else{
y.insert(j);
c.insert((j+M)%K);
done.insert((j+M)%K);
j = (j+M+M)%K;
}
}
if(ssize(y) == N){
cout << "Yes" << '\n';
for(int i = 0;auto v:y){
if(i++)cout << " ";
cout << v+1;
}
cout << '\n';
}else{
cout << "No" << '\n';
}
}
}
Andrew8128