結果
問題 | No.1816 MUL-DIV Game |
ユーザー |
![]() |
提出日時 | 2022-01-21 21:25:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 742 bytes |
コンパイル時間 | 4,236 ms |
コンパイル使用メモリ | 253,904 KB |
最終ジャッジ日時 | 2025-01-27 13:22:26 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using mint = modint998244353;using namespace std;#define rep(i,n) for(int i=0;i<(n);i++)#define Inf 1000000001int main(){int n;cin>>n;multiset<long long> a;rep(i,n){long long t;cin>>t;a.insert(t);}rep(i,n-1){if(i%2==0){auto it = a.begin();long long x = *it;a.erase(it);it = a.begin();long long y = *it;a.erase(it);a.insert(x*y);}else{auto it= a.end();it--;a.erase(it);it = a.end();it--;a.erase(it);a.insert(1LL);}}cout<<(*a.begin())<<endl;/*if(n==1)cout<<a[0]<<endl;else if(n==2)cout<<a[0]*a[1]<<endl;else cout<<1<<endl;*/return 0;}