結果
| 問題 | No.3204 Permuted Integer |
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2025-07-18 22:57:18 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 432 bytes |
| 記録 | |
| コンパイル時間 | 2,150 ms |
| コンパイル使用メモリ | 347,356 KB |
| 実行使用メモリ | 750,208 KB |
| 最終ジャッジ日時 | 2026-07-13 08:43:15 |
| 合計ジャッジ時間 | 6,673 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | MLE * 1 -- * 25 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
map<ll,bool> mp;
void solve(){
ll inf=1e18;
string n;
cin>>n;
sort(n.begin(),n.end());
ll ans=inf;
do{
ll x=stoll(n);
if (mp[x]) ans=min(ans,x);
}while(next_permutation(n.begin(),n.end()));
if (ans==inf) cout<<-1<<endl;
else cout<<ans<<endl;
}
int main(){
for (ll i=0;i<1e6;i++) mp[i*i]=true;
int t;
cin>>t;
while (t--) solve();
}
tau1235