結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
👑 |
提出日時 | 2025-07-18 21:38:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 911 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 378 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 163,200 KB |
最終ジャッジ日時 | 2025-07-18 23:37:42 |
合計ジャッジ時間 | 21,397 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 26 |
ソースコード
from collections import defaultdict from math import isqrt LIMIT = 10**9 mapping = defaultdict(lambda: -1) def trim(n): S = tuple(sorted()) def init(): for i in range(isqrt(LIMIT) + 1): s = tuple(sorted(str(i**2))) for x in range(s.count("0"), 10): val = tuple((["0"] * x) + list(filter(lambda v: v != "0", s))) if val not in mapping: mapping[val] = i**2 def solve(): N = int(input()) S = tuple(sorted(str(N))) print(mapping[S]) if __name__ == "__main__": init() T = int(input()) for _ in range(T): solve()