結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
![]() |
提出日時 | 2025-07-18 23:03:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,863 ms / 2,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 4,104 ms |
コンパイル使用メモリ | 287,144 KB |
実行使用メモリ | 25,856 KB |
最終ジャッジ日時 | 2025-08-11 17:51:52 |
合計ジャッジ時間 | 52,965 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 26 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; map<string,ll> mp; void solve(){ string n; cin>>n; sort(n.begin(),n.end()); if (mp[n]==0) cout<<-1<<endl; else cout<<mp[n]<<endl; } int main(){ for (ll i=0;i<1e6;i++){ string s=to_string(i*i); sort(s.begin(),s.end()); if (!mp.count(s)) mp[s]=i*i; while (s.size()<=12){ s="0"+s; if (mp.count(s)) continue; mp[s]=i*i; } } int t; cin>>t; while (t--) solve(); }