結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2016-06-24 11:31:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 298 ms / 5,000 ms |
コード長 | 1,052 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 65,968 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 23:31:51 |
合計ジャッジ時間 | 3,886 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <vector> #include <utility> #include <queue> using namespace std; typedef pair<int, int> P; const int kINF = 1 << 28; const int kMAX_N = 1510; int N; int A[kMAX_N], B[kMAX_N]; void Solve() { int answer = kINF; for (int i = 0; i < N; i++) { priority_queue<P, vector<P>, greater<P> > que; for (int m = 0; m < N; m++) { que.push(P(A[m], 0)); } int max_fight = 0; for (int j = 0; j < N; j++) { int enemy = (i + j) % N; P monster = que.top(); que.pop(); monster.first += B[enemy] / 2; monster.second += 1; que.push(monster); max_fight = max(max_fight, monster.second); } answer = min(answer, max_fight); } cout << answer << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } Solve(); return 0; }