結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
aqua
|
| 提出日時 | 2025-07-18 22:27:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 760 bytes |
| コンパイル時間 | 3,497 ms |
| コンパイル使用メモリ | 287,748 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-07-18 22:27:54 |
| 合計ジャッジ時間 | 7,548 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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() < 10) 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() < 10) 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();
}
aqua