結果

問題 No.9 モンスターのレベル上げ
コンテスト
ユーザー moyashi_senpai
提出日時 2016-08-19 09:19:41
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 927 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 767 ms
コンパイル使用メモリ 110,084 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-08 01:51:11
合計ジャッジ時間 3,270 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define REP(i,n) for(int i = 0; n > i; i++)

using namespace std;
typedef vector<int> Ivec;
typedef pair<long long int, int> pii;

int main() {
	int n;
	scanf("%d", &n);
	priority_queue<pii, vector<pii>, greater<pii>> a;
	vector<int> b(n);
	REP(i, n) {
		int x;
		scanf("%d", &x);
		a.push({ x,0 });
	}
	REP(i, n) scanf("%d", &b[i]);
	int ans = 0;
	REP(i, n) {
		priority_queue<pii, vector<pii>, greater<pii>> party = a;
		for(int j = 0; n > j; j++) {
			int num = (i + j)%n;
			pii cur = party.top();
			cur = { cur.first + (int) (b[num] / 2), cur.second + 1 };
			ans = max(ans, cur.second);
			party.pop();
			party.push(cur);
		}
	}

	printf("%d\n", ans);
	return 0;
}
0