結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-18 21:29:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 449 bytes |
| コンパイル時間 | 438 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 147,980 KB |
| 最終ジャッジ日時 | 2025-07-18 21:30:45 |
| 合計ジャッジ時間 | 48,641 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 WA * 15 TLE * 1 |
ソースコード
from collections import defaultdict
t = int(input())
d = defaultdict(list)
for i in range(1, 1000000):
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)