結果
| 問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-23 23:50:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 262 ms / 2,000 ms |
| コード長 | 901 bytes |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 82,848 KB |
| 実行使用メモリ | 126,572 KB |
| 最終ジャッジ日時 | 2024-08-23 23:50:39 |
| 合計ジャッジ時間 | 4,692 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
import sys
input = sys.stdin.readline
def solve():
k,m,n = map(int,input().split())
y = [j for j in range(k)]
c = [(y[i]+m-1)%k for i in range(k)]
ans = 0
s = set()
e = []
for i in range(k):
now = i
if now in s:
continue
temp = 1
x = [now]
while now not in s:
s.add(now)
now = c[now]
x.append(now)
temp += 1
x.pop()
e.append(x)
ans += len(x)//2
if n <= ans:
print('Yes')
cnt = 0
for i in e:
for j in range(len(i)):
if j % 2 == 1:
print(i[j]+1,end=' ')
cnt += 1
if cnt == n:
print()
return
else:
print('No')
return
for i in range(int(input())):
solve()