結果

問題 No.3204 Permuted Integer
ユーザー ルク
提出日時 2025-07-18 21:27:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 88,564 KB
最終ジャッジ日時 2025-07-18 21:28:03
合計ジャッジ時間 13,185 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

t = int(input())
d = defaultdict(list)
for i in range(1, 100000):
    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