結果
| 問題 | No.1611 Minimum Multiple with Double Divisors | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-07-21 22:13:35 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,282 bytes | 
| コンパイル時間 | 1,416 ms | 
| コンパイル使用メモリ | 175,220 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-17 18:58:49 | 
| 合計ジャッジ時間 | 30,059 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 8 WA * 28 TLE * 1 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:31:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   31 |                 for(auto [v, ko]: m){
      |                          ^
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int testcase;
    cin >> testcase;
    vector<int> prime(100, -1);
    for(int i = 2; i < 100; i++){
        if(prime[i] != -1) continue;
        int t = i;
        prime[i] = i;
        while(t + i < 100){
            t += i;
            prime[t] = i;
        }
    }
    while(testcase--){
        long long X;
        cin >> X;
        if(X % 2 == 1) cout << X * 2 << endl;
        else{
            long long res = 1000000000000000;
            for(long long i = 2; i < 100; i++){
                map<int, int> m;
                int t = i;
                while(t != 1){
                    m[prime[t]]++;
                    t /= prime[t];
                }
                long long cnt = 1;
                long long pre = 1;
                for(auto [v, ko]: m){
                    pre *= ko;
                    long long temp = X;
                    long long te = 0;
                    while(temp % v == 0){
                        temp /= v;
                        te++;
                    }
                    cnt *= te + 1;
                }
                if(pre == cnt){
                    res = min(res, i);
                }
            }
            cout << X * res << endl;
        }
    }
}
            
            
            
        