結果
| 問題 | No.2845 Birthday Pattern in Two Different Calendars |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-23 22:44:57 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,091 bytes |
| 記録 | |
| コンパイル時間 | 1,733 ms |
| コンパイル使用メモリ | 197,072 KB |
| 最終ジャッジ日時 | 2025-02-24 00:06:53 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 WA * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while(T--){
int k, m, n;
cin >> k >> m >> n;
m--;
if(2 * n > k){
cout << "No\n";
continue;
}
if(m == 0){
cout << "No\n";
continue;
}
vector<int> ans;
vector<bool> used(k);
int p = 0, cnt = 0;
int th = 10 * k;
while(true){
while(used[p] || used[(p + m) % k]){
p++;
cnt++;
if(p == k) p = 0;
if(cnt >= th) break;
}
if(cnt >= th) break;
used[p] = used[(p + m) % k] = true;
ans.emplace_back(p + 1);
p = (p + m - 1 + k) % k;
}
if(ans.size() < n){
cout << "No\n";
continue;
}
cout << "Yes\n";
for(int i = 0; i < n; i++){
cout << ans[i] << (i + 1 == n ? '\n' : ' ');
}
}
}