結果
| 問題 | No.3204 Permuted Integer |
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2025-07-18 23:03:33 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,521 ms / 2,000 ms |
| コード長 | 483 bytes |
| 記録 | |
| コンパイル時間 | 3,700 ms |
| コンパイル使用メモリ | 288,860 KB |
| 実行使用メモリ | 25,600 KB |
| 最終ジャッジ日時 | 2025-09-08 13:28:57 |
| 合計ジャッジ時間 | 43,261 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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();
}
tau1235