結果
| 問題 | No.2845 Birthday Pattern in Two Different Calendars |
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2024-08-23 22:56:19 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 103 ms / 2,000 ms |
| コード長 | 714 bytes |
| 記録 | |
| コンパイル時間 | 116 ms |
| コンパイル使用メモリ | 85,112 KB |
| 実行使用メモリ | 93,568 KB |
| 最終ジャッジ日時 | 2026-04-03 22:04:44 |
| 合計ジャッジ時間 | 2,641 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
import heapq
from heapq import heappop,heappush,heapify
from sys import stdin, setrecursionlimit
input = stdin.readline
readline = stdin.readline
T=int(input())
from collections import deque
d=deque()
for _ in range(T):
K,M,N=map(int, input().split())
V=[0]*K;ans=[]
for i in range(N):
nex=(i+M-1)%K
if V[i]==0 and V[nex]==0 and i!=nex:
ans.append((i+1))
p,q=i,nex
V[p]=1;V[q]=1
while True:
p=(q+M-1)%K
q=(p+M-1)%K
if V[p]==0 and V[q]==0:
V[p]=1;V[q]=1
ans.append((p+1))
else:
break
if len(ans)>=N:
print('Yes')
print(*ans[:N])
else:
print('No')
#C=list(map(int, input().split()))
timi