結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
togatoga
|
| 提出日時 | 2015-08-20 23:30:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 378 ms / 5,000 ms |
| コード長 | 1,166 bytes |
| コンパイル時間 | 1,507 ms |
| コンパイル使用メモリ | 167,936 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 23:04:14 |
| 合計ジャッジ時間 | 5,323 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const int INF=1<<29;
const double EPS=1e-9;
const int MOD = 100000007;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int N;
priority_queue<pii> que;
vector<int> monster;
int main(){
cin >> N;
for (int i = 0; i < N; i++){
int x;
cin >> x;
que.push(mp(-x, 0));
}
for (int i = 0; i < N; i++){
int x;
cin >> x;
monster.push_back(x);
}
ll ans = INF;
for (int start = 0; start < N; start++){
priority_queue<pii> tmp = que;
int cnt = 0;
while (cnt < N){
pii pos = tmp.top();
tmp.pop();
int level = monster[(start + cnt) % N] / 2;
cnt++;
pos.first -= level;
pos.second--;
tmp.push(pos);
}
ll res = 0;
while (!tmp.empty()){
pii pos = tmp.top();
tmp.pop();
res = max(res, (ll)-pos.second);
}
ans = min(ans, res);
}
cout << ans << endl;
}
togatoga