結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
![]() |
提出日時 | 2025-07-18 21:29:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 937 bytes |
コンパイル時間 | 3,162 ms |
コンパイル使用メモリ | 289,480 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-18 23:36:06 |
合計ジャッジ時間 | 7,473 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using a2 = array<ll, 2>; using a3 = array<ll, 3>; template <typename A> void chmin(A &l, const A &r) { if (r < l) l = r; } template <typename A> void chmax(A &l, const A &r) { if (l < r) l = r; } ll mod = 998244353; int main() { ios::sync_with_stdio(false); cin.tie(0); ll t; cin >> t; map<string, ll> mp; for (ll i = 1; i * i <= 1000000005; i++) { string s = to_string(i * i); sort(s.begin(), s.end()); while (s.size() < 10) { if (mp.contains(s) == false) mp[s] = i * i; s.insert(s.begin(), '0'); } } for (int tt = 0; tt < t; tt++) { string s; cin >> s; sort(s.begin(), s.end()); if (mp.contains(s)) cout << mp[s] << endl; else cout << -1 << endl; } return 0; }