結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
|
提出日時 | 2025-07-18 22:38:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 486 ms / 2,000 ms |
コード長 | 496 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 82,384 KB |
実行使用メモリ | 81,960 KB |
最終ジャッジ日時 | 2025-07-18 23:40:26 |
合計ジャッジ時間 | 9,788 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)