結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
|
| 提出日時 | 2021-03-29 02:11:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 353 ms / 5,000 ms |
| コード長 | 1,041 bytes |
| コンパイル時間 | 579 ms |
| コンパイル使用メモリ | 65,276 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-29 09:38:04 |
| 合計ジャッジ時間 | 4,173 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <climits>
#include <iostream>
#include <queue>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T MAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T MIN(T & a, const T b) { return a = (a > b) ? b : a; }
int main()
{
INIT;
int n; cin >> n;
int an[n], bn[n];
int ans = INT_MAX;
priority_queue< int, vector<int>, greater<int> > q;
REP(i, n) { cin >> an[i]; an[i] = an[i] << 12; }
REP(i, n) { cin >> bn[i]; bn[i] = (bn[i] / 2) << 12; }
REP(p, n) {
int times = 0;
REP(i, n) { q.push(an[i]); }
FOR(i, p, n) { int a = q.top() + bn[i] + 1; q.pop(); q.push(a); }
FOR(i, 0, p) { int a = q.top() + bn[i] + 1; q.pop(); q.push(a); }
while(!q.empty()) {
times = MAX<int>(times, q.top() & 0xFFF);
q.pop();
}
ans = MIN<int>(times, ans);
}
cout << ans << "\n";
return 0;
}