結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-19 20:34:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 2,318 ms |
| コンパイル使用メモリ | 201,696 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-07-19 20:34:38 |
| 合計ジャッジ時間 | 6,692 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
constexpr int r = 32000;
vector<int> a(r + 1);
for(int i = 1; i <= r; i++) a[i] = i * i;
int T;
cin >> T;
while(T--){
string s;
cin >> s;
sort(s.begin(), s.end());
int ans = -1, v;
do{
v = stoi(s);
if(binary_search(a.begin(), a.end(), v)){
ans = v;
break;
}
}while(next_permutation(s.begin(), s.end()));
cout << ans << '\n';
}
}