結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2015-03-04 00:23:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 527 ms / 5,000 ms |
| コード長 | 924 bytes |
| コンパイル時間 | 685 ms |
| コンパイル使用メモリ | 72,488 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 22:32:40 |
| 合計ジャッジ時間 | 5,995 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
#include <queue>
using namespace std;
typedef vector<int> IntVec;
typedef pair<int, int> II;
typedef priority_queue<II> Queue;
int main(int argc, char *argv[])
{
string s;
getline(cin, s);
int N = atoi(s.c_str());
IntVec A(N), B(N);
{
getline(cin, s);
stringstream ss(s);
for (int i = 0; i < N; ++i) {
ss >> A[i];
}
}
{
getline(cin, s);
stringstream ss(s);
for (int i = 0; i < N; ++i) {
ss >> B[i];
}
}
int ans = 1 << 30;
for (int i = 0; i < N; ++i) {
Queue q;
for (int j = 0; j < N; ++j) {
q.push(II(-A[j], 0));
}
for (int k = 0; k < N; ++k) {
II x = q.top();
q.pop();
x.first -= B[(i + k) % N] / 2;
x.second -= 1;
q.push(x);
}
int m = 0;
while (q.size()) {
II x = q.top();
q.pop();
m = max(m, -x.second);
}
ans = min(ans, m);
}
cout << ans << endl;
return 0;
}
hotpepsi