結果

問題 No.9 モンスターのレベル上げ
ユーザー A8pfA8pf
提出日時 2018-10-03 11:56:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 440 ms / 5,000 ms
コード長 999 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 77,864 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-02 14:35:46
合計ジャッジ時間 5,351 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 440 ms
4,376 KB
testcase_03 AC 351 ms
4,380 KB
testcase_04 AC 183 ms
4,380 KB
testcase_05 AC 119 ms
4,376 KB
testcase_06 AC 40 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 53 ms
4,380 KB
testcase_09 AC 427 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 364 ms
4,376 KB
testcase_12 AC 296 ms
4,376 KB
testcase_13 AC 211 ms
4,376 KB
testcase_14 AC 429 ms
4,376 KB
testcase_15 AC 388 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 247 ms
4,376 KB
testcase_18 AC 205 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <functional>
#include <queue>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
ll MOD = 1e9+7;

int main()
{
	int n;
	priority_queue<P,vector<P>,greater<P>> aa;//レベル、戦闘回数
	int a[1500];//入力用
	int b[1500];
	int ans=1e9-1;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	
	//0から順番に時計回りに戦闘する
	for(int i=0;i<n;i++)
	{
		//init
		for(int j=0;j<n;j++)
			aa.push(make_pair(a[j],0));
		//indexは(i+j)%nで求まる
		for(int j=0;j<n;j++)
		{
			int now=(i+j)%n;
			if(now<0)
				now+=n;
			pair<int,int> c=aa.top();aa.pop();
			c.first+=b[now]/2;
			c.second++;
			aa.push(c);
		}
		//最も多かった戦闘回数を求める
		int m=0;
		while(!aa.empty())
		{
			pair<int,int> c=aa.top();aa.pop();
			m=max(m,c.second);
		}
		
		ans=min(ans,m);
	}
	cout<<ans<<endl;
	return 0;
}
0