結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
|
提出日時 | 2025-07-19 12:45:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 377 ms / 2,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 625 ms |
コンパイル使用メモリ | 82,192 KB |
実行使用メモリ | 95,060 KB |
最終ジャッジ日時 | 2025-07-19 12:45:23 |
合計ジャッジ時間 | 9,361 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 26 |
ソースコード
t,*ns=map(int,open(0).read().split()) s={} for i in range(10**5): t=''.join(sorted(str(i*i))) if t not in s: s[t]=i*i for n in ns: sn=sorted(str(n))[::-1] ans=INF=1<<60 while 1: t=''.join(sorted(sn)) if t in s: ans=min(ans,s[t]) if sn[-1]=='0': sn.pop() else: break print([-1,ans][ans<INF])