結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2025-07-29 17:16:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 681 bytes |
| コンパイル時間 | 2,137 ms |
| コンパイル使用メモリ | 203,100 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-07-29 17:16:32 |
| 合計ジャッジ時間 | 5,763 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
int main() {
fast_io();
map<string, int> mp;
const int M = 1e9 + 5;
for (int i = 1; i * i <= M; i++) {
int num = i * i;
string dig_cnt(10, '0');
int tot = 0;
while (num > 0) {
dig_cnt[num % 10]++;
num /= 10;
tot++;
}
while (tot < 10) {
mp[dig_cnt] = i * i;
dig_cnt[0]++;
tot++;
}
}
int t;
cin >> t;
for (; t--;) {
int n;
cin >> n;
string dig_cnt(10, '0');
while (n > 0) {
dig_cnt[n % 10]++;
n /= 10;
}
if (mp.count(dig_cnt)) {
cout << mp[dig_cnt] << '\n';
} else {
cout << -1 << '\n';
}
}
}
eve__fuyuki