結果

問題 No.9 モンスターのレベル上げ
ユーザー soupesuteakasoupesuteaka
提出日時 2014-12-30 00:36:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,041 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 89,192 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 20:16:09
合計ジャッジ時間 5,847 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 382 ms
4,376 KB
testcase_12 AC 300 ms
4,380 KB
testcase_13 AC 213 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 251 ms
4,376 KB
testcase_18 AC 211 ms
4,380 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <iomanip>

#define INF 1000000001
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const double PI = acos(-1.0);

int N;
int A[1501], B[1501];

int main()
{
	ios::sync_with_stdio(false);

	cin >> N;
	FOR(i,0,N) cin >> A[i];
	FOR(i,0,N) cin >> B[i];

	FOR(i,0,N) B[i] /= 2;

	int ans=INF;
	FOR(st,0,N) {
		priority_queue< pair<int, int> > heap;
		FOR(i,0,N) heap.push(pii (-A[i], 0));
		FOR(i,0,N) {
			int e = (st+i) % N;
			pii p = heap.top(); heap.pop();
			heap.push(pii(p.first-B[i], p.second-1));
		}
		int t = 0;
		while (!heap.empty()) {
			pii p = heap.top(); heap.pop();
			t = max(t, -p.second);
		}
		ans = min(ans, t);
	}
	cout << ans << endl;
	return 0;
}
0