結果
| 問題 |
No.3236 累乗数大好きbot
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-15 22:55:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 246 ms / 4,000 ms |
| コード長 | 864 bytes |
| コンパイル時間 | 1,871 ms |
| コンパイル使用メモリ | 203,212 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2025-08-15 22:55:41 |
| 合計ジャッジ時間 | 6,889 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
return x < y ? (x = y, true) : false;
}
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
void solve() {
int q;
cin >> q;
vector<ll> a(q);
rep(i, 0, q) cin >> a[i];
map<ll, int> mp;
rep(i, 0, q) mp[a[i]] = 1;
for (ll d = 2; d <= 1e6; d++) {
ll pw = d * d;
for (int ct = 2;; ct++) {
if (mp.count(pw)) {
chmax(mp[pw], ct);
}
pw *= d;
if (pw > 1e12) break;
}
}
rep(i, 0, q) cout << mp[a[i]] << "\n";
}
int main() {
int t = 1;
// cin >> t;
while (t--) solve();
}