結果
問題 |
No.3204 Permuted Integer
|
ユーザー |
![]() |
提出日時 | 2025-07-18 22:21:02 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 758 bytes |
コンパイル時間 | 3,799 ms |
コンパイル使用メモリ | 288,408 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-18 22:21:11 |
合計ジャッジ時間 | 7,366 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 WA * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } map<string, int> mp; void solve() { string N; cin >> N; while(N.size() < 9) N += '0'; sort(N.begin(), N.end()); if(mp.count(N)) cout << mp[N] << endl; else cout << -1 << endl; return; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); for(int i=1; i*i<=1'000'000'000; ++i) { int y = i*i; string x = to_string(y); while(x.size() < 9) x += '0'; sort(x.begin(), x.end()); if(!mp.count(x)) mp[x] = y; } int T; cin >> T; for(int i=0; i<T; ++i) solve(); }