結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
opqopq_
|
| 提出日時 | 2015-05-11 20:36:40 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 836 bytes |
| 記録 | |
| コンパイル時間 | 713 ms |
| コンパイル使用メモリ | 63,232 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-03-27 09:10:51 |
| 合計ジャッジ時間 | 3,335 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 14 |
ソースコード
#include <cstdio>
#include <queue>
using namespace std;
#define N_MAX 1500
struct State {
int level, turn;
State(int l) : level(l), turn(0) {}
bool operator < (const State& r) const {
if (level != r.level) return level > r.level;
return turn > r.turn;
}
};
int N;
int A[N_MAX], B[N_MAX];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++) scanf("%d", A + i);
for (int i = 0; i < N; i++) scanf("%d", B + i);
int res = 0;
priority_queue<State> pq;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) pq.emplace(A[j]);
int j = i, cnt = 0;
while (cnt != N) {
State s = pq.top();
pq.pop();
s.level += B[j] / 2;
s.turn++;
pq.push(s);
j = (j + 1) % N;
cnt++;
}
while (!pq.empty()) {
res = max(res, pq.top().turn);
pq.pop();
}
}
printf("%d\n", res);
return 0;
}
opqopq_