結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
![]() |
提出日時 | 2025-07-18 21:50:16 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 771 bytes |
コンパイル時間 | 3,532 ms |
コンパイル使用メモリ | 288,644 KB |
実行使用メモリ | 9,216 KB |
最終ジャッジ日時 | 2025-07-18 21:50:52 |
合計ジャッジ時間 | 22,275 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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<=1000000000000;i++){ ll now=i*i; string s=to_string(now); sort(s.begin(),s.end()); ll a=stoll(s); if(dat.count(a)==0) dat[a]=now; else dat[a]=min(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"; } }