結果

問題 No.9 モンスターのレベル上げ
ユーザー snrnsidysnrnsidy
提出日時 2021-03-10 03:11:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 227 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 2,580 ms
コンパイル使用メモリ 200,624 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 00:43:04
合計ジャッジ時間 4,511 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 226 ms
5,376 KB
testcase_03 AC 185 ms
5,376 KB
testcase_04 AC 97 ms
5,376 KB
testcase_05 AC 65 ms
5,376 KB
testcase_06 AC 23 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 28 ms
5,376 KB
testcase_09 AC 227 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 165 ms
5,376 KB
testcase_12 AC 141 ms
5,376 KB
testcase_13 AC 144 ms
5,376 KB
testcase_14 AC 227 ms
5,376 KB
testcase_15 AC 205 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 132 ms
5,376 KB
testcase_18 AC 110 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
	int n,t;
	vector <int> A,B;

	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> t;
		A.push_back(t);
	}
	for(int i=0;i<n;i++)
	{
		cin >> t;
		B.push_back(t);
	}

	int res = 1e9;
	for(int i=0;i<n;i++)
	{
		priority_queue <pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pque;
		for(int j=0;j<n;j++)
		{
			pque.push({A[j],0});
		}
		int idx = i;
		int MAX = 0;
		for(int j=0;j<n;j++)
		{
			int exp = pque.top().first;
			int cnt = pque.top().second;
			pque.pop();
			cnt+=1;
			MAX = max(MAX,cnt);
			exp += (B[idx]/2);
			pque.push({exp,cnt});
			idx++;
			if(idx>=n)
			{
				idx-=n;
			}
		}
		res = min(res,MAX);
	}
	cout << res << '\n';
    return 0;
}
0