結果

問題 No.1816 MUL-DIV Game
ユーザー sxmIKjcEGh46HMF
提出日時 2022-01-21 22:37:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 486 bytes
コンパイル時間 4,905 ms
コンパイル使用メモリ 231,872 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 01:37:28
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>

#define fi first
#define se second
#define eb emplace_back

using namespace std;
using namespace atcoder;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    sort(A.rbegin(), A.rend());

    ll ans = A[0];
    for (int i = 1; i < N; ++i) {
        if (i % 2) ans *= A[i];
        else ans = (ans + A[i] - 1) / A[i];
    }

    cout << ans << endl;
    return 0;
}
0