結果
問題 |
No.1816 MUL-DIV Game
|
ユーザー |
![]() |
提出日時 | 2022-01-21 22:54:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 729 bytes |
コンパイル時間 | 2,587 ms |
コンパイル使用メモリ | 198,204 KB |
最終ジャッジ日時 | 2025-01-27 14:18:35 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; vector<int> a(n); for (auto& x : a) cin>>x; multiset<int> ms(a.begin(), a.end()); for (int i = 0; i < n-1; ++i) { assert(ms.size() >= 2); if (i & 1) { // Bob's turn int x1 = *prev(ms.end()); ms.erase(prev(ms.end())); int x2 = *prev(ms.end()); ms.erase(prev(ms.end())); ms.insert((x2 + x1 - 1)/x1); } else { // Alice's turn int xl = *ms.begin(); int xr = *prev(ms.end()); ms.erase(ms.begin()); ms.erase(prev(ms.end())); ms.insert(xl*xr); } } assert(ms.size() == 1); cout << *ms.begin() << endl; }