結果

問題 No.9 モンスターのレベル上げ
ユーザー TwizzTwizz
提出日時 2017-05-14 23:17:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 456 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 2,452 ms
コンパイル使用メモリ 150,104 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 05:17:35
合計ジャッジ時間 6,259 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 456 ms
4,376 KB
testcase_03 AC 361 ms
4,376 KB
testcase_04 AC 191 ms
4,376 KB
testcase_05 AC 124 ms
4,376 KB
testcase_06 AC 42 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 57 ms
4,380 KB
testcase_09 AC 443 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 385 ms
4,380 KB
testcase_12 AC 308 ms
4,376 KB
testcase_13 AC 217 ms
4,376 KB
testcase_14 AC 443 ms
4,376 KB
testcase_15 AC 404 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 259 ms
4,380 KB
testcase_18 AC 217 ms
4,380 KB
testcase_19 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
const ll mod = 200000;

int main() {
	int n;
	int a[1502], b[1502];
	cin >> n;
	rep(i, 0, n) { cin >> a[i] ; }
	rep(i, 0, n) { cin >> b[i]; }
	int ans = n;
	rep(i, 0, n) {
		priority_queue<pair<int, int>> pq;
		for (int j = 0; j < n; j++) { pq.push(make_pair(-a[j], 0)); }
		rep(j, 0, n) {
			int up = b[(i + j) % n]/2;
			auto now = pq.top();
			pq.pop();
			pq.push(make_pair(now.first - up, now.second - 1));
		}

		int temp = 0;
		while (!pq.empty()) {
			auto now = pq.top(); pq.pop();
			temp = max(-now.second, temp);
		}
		ans = min(temp, ans);
	}
	print(ans);
}
0