結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
newlife171128
|
| 提出日時 | 2018-02-12 20:26:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 371 ms / 5,000 ms |
| コード長 | 1,462 bytes |
| コンパイル時間 | 2,881 ms |
| コンパイル使用メモリ | 166,496 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 00:24:42 |
| 合計ジャッジ時間 | 5,476 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#include "bits/stdc++.h"
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <unordered_map>
#include <string.h>
#include <utility>
typedef long long ll;
const int INF = 1e8;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef pair<int, int> P;
int n = 0;
priority_queue<P, vector<P>, greater<P>> Q;
priority_queue<P, vector<P>, greater<P>> Qq;
vector<P> motimons;
P tmpmons;
int tekimons[3010];
void inite() {
for (int i = 0; i < n; i++) {
Qq.push(motimons[i]);
}
}
int main() {
cin >> n;
int tmp;
for (int i = 0; i < n; i++) {
cin >> tmp;
motimons.push_back(P(tmp, 0));
}
for (int i = 0; i < n; i++) {
cin >> tmp;
tekimons[i] = tmp;
tekimons[n + i] = tmp;
}
inite();
/* for (int i = 0; i < n * 2; i++) {
cout << tekimons[i] << endl;
}*/
int ans = 100000000;
for (int k = 0; k < n ; k++) {
Q = Qq;
int mct=-1;
for (int i = k; i < n +k; i++) {
P p = Q.top();
Q.pop();
int level = p.first;
int ct = p.second;
level = level + (tekimons[i] / 2);
ct++;
Q.push(P(level, ct));
}
while (!Q.empty()) {
P p = Q.top();
Q.pop();
mct = max(mct,p.second);
/* cout << p.first << " " << p.second << endl;*/
}
ans = min(ans, mct);
}
cout<<ans<<endl;
return 0;
}
newlife171128