結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 20 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 44 ms
5,376 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 43 ms
5,376 KB
testcase_19 AC 43 ms
5,376 KB
testcase_20 AC 42 ms
5,376 KB
testcase_21 AC 42 ms
5,376 KB
testcase_22 AC 43 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 32 ms
5,376 KB
testcase_35 AC 10 ms
5,376 KB
testcase_36 AC 28 ms
5,376 KB
testcase_37 AC 24 ms
5,376 KB
testcase_38 AC 16 ms
5,376 KB
testcase_39 AC 11 ms
5,376 KB
testcase_40 AC 14 ms
5,376 KB
testcase_41 AC 8 ms
5,376 KB
testcase_42 AC 25 ms
5,376 KB
testcase_43 AC 26 ms
5,376 KB
testcase_44 AC 19 ms
5,376 KB
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-a[n-1].second << endl;
}
0