結果
| 問題 | No.3204 Permuted Integer |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-07-19 00:07:33 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 325 ms / 2,000 ms |
| + 344µs | |
| コード長 | 504 bytes |
| 記録 | |
| コンパイル時間 | 617 ms |
| コンパイル使用メモリ | 96,108 KB |
| 実行使用メモリ | 114,904 KB |
| 最終ジャッジ日時 | 2026-07-13 09:21:04 |
| 合計ジャッジ時間 | 9,048 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 |
ソースコード
import sys
input = sys.stdin.readline
D=dict()
for i in range(1,100000):
x=i*i
s=tuple(sorted(str(x)))
if s in D:
pass
else:
D[s]=x
T=int(input())
for tests in range(T):
X=tuple(sorted(input().strip()))
ANS=-1
while True:
if X in D:
if ANS==-1:
ANS=D[X]
else:
ANS=min(ANS,D[X])
if X[0]=="0":
X=X[1:]
else:
break
print(ANS)
titia