結果

問題 No.1816 MUL-DIV Game
ユーザー se1ka2se1ka2
提出日時 2022-01-21 21:42:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 1,836 ms
コンパイル使用メモリ 79,676 KB
実行使用メモリ 9,844 KB
最終ジャッジ日時 2023-08-17 05:23:03
合計ジャッジ時間 3,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 45 ms
6,312 KB
testcase_11 AC 40 ms
5,844 KB
testcase_12 AC 29 ms
5,180 KB
testcase_13 AC 66 ms
7,120 KB
testcase_14 AC 34 ms
5,708 KB
testcase_15 AC 45 ms
6,088 KB
testcase_16 AC 10 ms
4,376 KB
testcase_17 AC 93 ms
8,488 KB
testcase_18 AC 89 ms
8,160 KB
testcase_19 AC 39 ms
5,800 KB
testcase_20 AC 97 ms
8,708 KB
testcase_21 AC 30 ms
5,492 KB
testcase_22 AC 23 ms
4,792 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 122 ms
9,588 KB
testcase_26 AC 123 ms
9,664 KB
testcase_27 AC 120 ms
9,600 KB
testcase_28 AC 122 ms
9,844 KB
testcase_29 AC 120 ms
9,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	map<ll, int> mp;
	for(int i = 0; i < n; i++){
		ll a;
		cin >> a;
		mp[a]++;
	}
	for(int i = 0; i < n - 1; i++){
		if(i % 2 == 0){
			auto itr = mp.begin();
			ll a = itr->first;
			mp[itr->first]--;
			if(mp[itr->first] == 0) mp.erase(itr->first);
			itr = mp.begin();
			ll b = itr->first;
			mp[itr->first]--;
			if(mp[itr->first] == 0) mp.erase(itr->first);
			mp[a * b]++;
		}
		else{
			auto itr = --mp.end();
			mp[itr->first]--;
			if(mp[itr->first] == 0) mp.erase(itr->first);
			itr = --mp.end();
			mp[itr->first]--;
			if(mp[itr->first] == 0) mp.erase(itr->first);
			mp[1]++;
		}
	}
	cout << mp.begin()->first << endl;
}
0