結果

問題 No.1816 MUL-DIV Game
ユーザー horoyoisawa
提出日時 2022-01-21 22:04:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 169,684 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-11-26 00:14:09
合計ジャッジ時間 3,702 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    multiset<long long> st;
    for(int i=0;i<n;i++) {
        int a;
        cin >> a;
        st.insert(a);
    }
    for(int i=0;i<n-1;i++) {
        auto it = st.end();
        it--;
        long long alpha = *it;
        st.erase(it);
        it = st.end();
        it--;
        long long beta = *it;
        st.erase(it);
        long long gamma;
        if(i % 2 == 0) {
            gamma = alpha * beta;
        }
        else gamma = 1;
        st.insert(gamma);
    }


    cout << *st.begin() << '\n';

    return 0;
}
0