結果
問題 |
No.1816 MUL-DIV Game
|
ユーザー |
|
提出日時 | 2022-01-21 21:48:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 837 bytes |
コンパイル時間 | 1,730 ms |
コンパイル使用メモリ | 170,708 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-11-25 23:32:59 |
合計ジャッジ時間 | 3,307 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 15 |
ソースコード
#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%2) { if(w%v) st.insert(w/v+1); else st.insert(w/v); } else st.insert(v*w); now++; } cout << *st.begin() << endl; }