結果

問題 No.9 モンスターのレベル上げ
ユーザー atn112323atn112323
提出日時 2016-05-03 18:33:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 738 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 67,632 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 10:33:33
合計ジャッジ時間 3,946 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 266 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 108 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 25 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 33 ms
5,376 KB
testcase_09 AC 256 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 227 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 260 ms
5,376 KB
testcase_15 AC 237 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 150 ms
6,948 KB
testcase_18 AC 126 ms
6,940 KB
testcase_19 AC 4 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>

using namespace std;

int N;
int A[1500], AA[1500], B[1500];
int cnt[1500];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}
	int res = N;
	for (int i = 0; i < N; i++) {
		priority_queue<pair<int, int> > P;
		for (int j = 0; j < N; j++) {
			AA[j] = A[j];
			cnt[j] = 0;
			P.push(make_pair(-(AA[j] * N + cnt[j]), j));
		}
		for (int j = 0; j < N; j++) {
			int k = (i + j) % N;
			pair<int, int> p = P.top();
			P.pop();
			cnt[p.second]++;
			AA[p.second] += B[k] / 2;
			P.push(make_pair(-(AA[p.second] * N - cnt[p.second]), p.second));
		}
		res = min(res, *max_element(cnt, cnt + N));
	}
	cout << res << endl;
	return 0;
}
0