結果

問題 No.3204 Permuted Integer
ユーザー ルク
提出日時 2025-07-18 21:27:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 78,400 KB
最終ジャッジ日時 2025-07-18 21:27:18
合計ジャッジ時間 7,531 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

t = int(input())
d = defaultdict(list)
for i in range(1, 3500):
    s = str(i*i)
    l = [0]*10
    for c in s:
        if int(c) != 0:
            l[int(c)] += 1
    d[tuple(l)].append(i)
for _ in range(t):
    n = int(input())
    lis = [0]*10
    for c in str(n):
        if int(c) != 0:
            lis[int(c)] += 1
    if tuple(lis) in d:
        print(min(d[tuple(lis)])**2)
    else:
        print(-1)
0