結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
ゼリトキ
|
| 提出日時 | 2025-07-18 21:29:19 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 730 bytes |
| コンパイル時間 | 4,655 ms |
| コンパイル使用メモリ | 286,164 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-07-18 21:30:08 |
| 合計ジャッジ時間 | 6,103 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
const long long mod=998244353;
const long long hmod=46216567629137;
int main(){
cin.tie(0)->sync_with_stdio(0);
cout.tie(0);
int T;
cin>>T;
map<ll,ll>dat;
for(ll i=1;i*i<=10000000000;i++){
ll now=i*i;
string s=to_string(now);
sort(s.begin(),s.end());
ll a=stoll(s);
if(!dat.count(a)) dat[a]=now;
}
for(int z=1;z<=T;z++){
ll N;
cin>>N;
string s=to_string(N);
sort(s.begin(),s.end());
ll a=stoll(s);
if(dat.count(a)){
cout<<dat[a]<<"\n";
}
else cout<<"-1\n";
}
}
ゼリトキ