結果

問題 No.9 モンスターのレベル上げ
ユーザー snrnsidysnrnsidy
提出日時 2021-03-10 03:11:23
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 250 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 2,051 ms
使用メモリ 3,592 KB
最終ジャッジ日時 2022-12-04 16:50:54
合計ジャッジ時間 5,354 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,396 KB
testcase_01 AC 1 ms
3,532 KB
testcase_02 AC 250 ms
3,516 KB
testcase_03 AC 203 ms
3,516 KB
testcase_04 AC 102 ms
3,556 KB
testcase_05 AC 66 ms
3,492 KB
testcase_06 AC 24 ms
3,548 KB
testcase_07 AC 2 ms
3,516 KB
testcase_08 AC 30 ms
3,524 KB
testcase_09 AC 241 ms
3,444 KB
testcase_10 AC 2 ms
3,432 KB
testcase_11 AC 187 ms
3,452 KB
testcase_12 AC 155 ms
3,528 KB
testcase_13 AC 130 ms
3,564 KB
testcase_14 AC 242 ms
3,512 KB
testcase_15 AC 219 ms
3,440 KB
testcase_16 AC 5 ms
3,516 KB
testcase_17 AC 140 ms
3,592 KB
testcase_18 AC 117 ms
3,452 KB
testcase_19 AC 3 ms
3,492 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