結果
| 問題 | No.3204 Permuted Integer |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-18 22:38:44 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 340 ms / 2,000 ms |
| + 739µs | |
| コード長 | 496 bytes |
| 記録 | |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 96,108 KB |
| 実行使用メモリ | 90,728 KB |
| 最終ジャッジ日時 | 2026-07-13 09:15:21 |
| 合計ジャッジ時間 | 8,374 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 |
ソースコード
from collections import defaultdict
T=int(input())
D=defaultdict(int)
Z=defaultdict(int)
for i in range(1,31623):
C=[0 for _ in range(10)]
A=list(str(i**2))
for a in A:
C[int(a)]+=1
if tuple(C[1:]) not in D:
D[tuple(C[1:])]=i**2
Z[i**2]=C[0]
for _ in range(T):
N=list(input())
C=[0 for _ in range(10)]
for n in N:
C[int(n)]+=1
ans=-1
if tuple(C[1:]) in D and C[0]>=Z[D[tuple(C[1:])]]:
ans=D[tuple(C[1:])]
print(ans)