結果
| 問題 | No.3448 ABBBBBBBBC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-24 00:54:25 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 270 ms / 2,000 ms |
| コード長 | 799 bytes |
| 記録 | |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 78,284 KB |
| 実行使用メモリ | 86,896 KB |
| 最終ジャッジ日時 | 2026-02-24 00:54:29 |
| 合計ジャッジ時間 | 2,803 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
import sys
input = sys.stdin.readline
T = int(input())
NK = [list(map(int, input().split())) for _ in range(T)]
for N, K in NK:
K-=1
tmp = list("123456789")
idx1 = K//(72*N)
U1 = tmp[idx1]
tmp.remove(U1)
#print(U1, tmp)
amari = K%(72*N)
tmp = ["0"] + tmp
idx2 = amari//(8*N)
U2 = tmp[idx2]
tmp.remove(U2)
#print(U2, tmp)
amari2 = amari%(8*N)
#print(amari2)
mi = 0
for t in tmp:
if t<U2:
mi+=1
#print(mi)
if amari2<mi*N:
idx3 = amari2//mi
L = idx3+1
idx4 = amari2%mi
UZ = tmp[idx4]
else:
amari3 = amari2 - mi*N
idx3 = amari3//(len(tmp)-mi)
L = N-idx3
idx4 = amari3%(len(tmp)-mi) + mi
UZ = tmp[idx4]
print(L+2, U1, U2, UZ)