結果

問題 No.1816 MUL-DIV Game
ユーザー iw522iw522
提出日時 2022-01-21 21:29:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 770 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 168,232 KB
実行使用メモリ 8,132 KB
最終ジャッジ日時 2023-08-17 05:01:42
合計ジャッジ時間 6,965 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)n; i++)
#define reps(i,n) for(ll i=1; i<=(ll)n; i++)
#define repi(i,a,b) for(ll i=(ll)a; i<(ll)b; i++)
#define pb push_back
#define mp make_pair
#define ALL(i) i.begin(),i.end()
ll INF = 1000000000000000;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll a;
    multiset<ll> st;
    rep(i,n) {
        cin >> a;
        st.insert(a);
    }
    ll now=0;
    while(st.size()!=1){
        ll v=*prev(st.end());
        ll w=*prev(prev(st.end()));
        st.erase(st.find(v));
        st.erase(st.find(w));
        if(now) st.insert(w/v);
        else st.insert(v*w);
        now++;
    }
    cout << *st.begin() << endl;
}
0