結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-18 21:51:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 562 bytes |
| コンパイル時間 | 2,443 ms |
| コンパイル使用メモリ | 205,144 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-07-18 21:51:29 |
| 合計ジャッジ時間 | 5,130 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
map<string,int> M;
for(int i=1; i*i<=1001001001; i++){
int v = i*i;
string s = to_string(v);
sort(s.begin(),s.end());
while(s.size() <= 10){
M[s] = v;
s.insert(s.begin(),'0');
}
}
int T; cin >> T;
while(T--){
string s; cin >> s;
sort(s.begin(),s.end());
if(M.count(s)) cout << M[s] << "\n";
else cout << "-1\n";
}
}