結果

問題 No.9 モンスターのレベル上げ
ユーザー kotatsugame
提出日時 2019-10-14 02:30:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 468 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 75,648 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-21 08:28:16
合計ジャッジ時間 5,846 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<queue>
using namespace std;
int N;
int A[1500],B[1500];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	int ans=1e9;
	for(int i=0;i<N;i++)
	{
		priority_queue<pair<int,int> >P;
		for(int j=0;j<N;j++)P.push(make_pair(-A[j],0));
		for(int j=0;j<N;j++)
		{
			pair<int,int>p=P.top();P.pop();
			p.first-=B[(i+j)%N]/2;
			p.second-=1;
			P.push(p);
		}
		int now=0;
		while(!P.empty())
		{
			if(now<-P.top().second)now=-P.top().second;
			P.pop();
		}
		if(ans>now)ans=now;
	}
	cout<<ans<<endl;
}
0