結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-07-20 00:49:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 862 bytes |
| コンパイル時間 | 3,077 ms |
| コンパイル使用メモリ | 283,552 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-07-20 00:49:41 |
| 合計ジャッジ時間 | 5,701 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
using arr = array<int, 9>;
map<arr, int> mp;
for (int i = 1; i * i <= 1'000'000'000; ++i) {
int x = i * i;
string s = to_string(x);
arr a = { 0 };
for (char c : s) {
if (c == '0') continue;
a[c - '1']++;
}
if (!mp.contains(a)) mp[a] = x;
}
int q;
cin >> q;
while (q--) {
string s;
cin >> s;
arr a = { 0 };
for (char c : s) {
if (c == '0') continue;
a[c - '1']++;
}
if (mp.contains(a)) {
cout << mp[a] << '\n';
}
else {
cout << -1 << '\n';
}
}
return 0;
}
a01sa01to