結果

問題 No.9 モンスターのレベル上げ
ユーザー naimonon77naimonon77
提出日時 2016-05-17 11:31:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 431 ms / 5,000 ms
コード長 2,836 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 176,348 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 04:37:07
合計ジャッジ時間 6,287 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 431 ms
4,376 KB
testcase_03 AC 340 ms
4,380 KB
testcase_04 AC 181 ms
4,376 KB
testcase_05 AC 119 ms
4,380 KB
testcase_06 AC 41 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 54 ms
4,380 KB
testcase_09 AC 424 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 350 ms
4,376 KB
testcase_12 AC 287 ms
4,376 KB
testcase_13 AC 191 ms
4,380 KB
testcase_14 AC 417 ms
4,380 KB
testcase_15 AC 376 ms
4,380 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 243 ms
4,376 KB
testcase_18 AC 205 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;
#define P pair<int,int>
signed main(void)
{
	int N;
	int a[1500];
	int b[1500];
	cin >> N;
	rep(i, N) cin >> a[i];
	rep(i, N) cin >> b[i];
	int ans = INT_MAX;
	rep(i, N) {
		priority_queue<pair<int, int>, vector<P>, greater<P>> pq;
		rep(j, N) {
			pq.push(make_pair(a[j], 0));
		}
		// first : level , second : 戦った回数
		rep(j, N) {
			auto now = pq.top();
			pq.pop();
			now.first += b[(i + j) % N]/2;
			++now.second;
			pq.push(now);
		}
		int ansi = 0;
		while (pq.size()) {
			if (ansi < pq.top().second) {
				ansi = pq.top().second;
			}
			pq.pop();
		}
		if (ans > ansi) ans = ansi;
	}
	cout << ans << endl;
	return 0;
}
0