結果

問題 No.1330 Multiply or Divide
ユーザー shu8Creamshu8Cream
提出日時 2021-01-08 23:18:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 206,724 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 05:29:10
合計ジャッジ時間 4,920 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 19 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 43 ms
6,944 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 44 ms
6,940 KB
testcase_19 AC 45 ms
6,940 KB
testcase_20 AC 42 ms
6,944 KB
testcase_21 AC 41 ms
6,944 KB
testcase_22 AC 41 ms
6,940 KB
testcase_23 WA -
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 1 ms
6,940 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 1 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 31 ms
6,944 KB
testcase_35 AC 9 ms
6,944 KB
testcase_36 AC 28 ms
6,944 KB
testcase_37 AC 24 ms
6,940 KB
testcase_38 AC 15 ms
6,940 KB
testcase_39 AC 11 ms
6,940 KB
testcase_40 AC 13 ms
6,944 KB
testcase_41 AC 8 ms
6,940 KB
testcase_42 AC 24 ms
6,940 KB
testcase_43 AC 26 ms
6,944 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
*    author:  shu8Cream
*    created: 08.01.2021 21:06:40
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,p;
    cin >> n >> m >> p;
    vector<P> a(n);
    rep(i,n){
        cin >> a[i].first;
        while(a[i].first%p==0){
            a[i].first/=p;
            a[i].second++;
        }
    }
    sort(all(a));
    int tmp = 1;
    int ans = 0;
    if(a[n-1].first==1){
        cout << -1 << endl;
        return 0;
    }
    while(tmp<m){
        tmp*=a[n-1].first;
        ans+=a[n-1].second+1;
    }
    cout << ans << endl;
}
0