結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-28 14:07:13 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 307 ms / 5,000 ms |
| + 499µs | |
| コード長 | 717 bytes |
| 記録 | |
| コンパイル時間 | 1,491 ms |
| コンパイル使用メモリ | 200,824 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-28 14:07:35 |
| 合計ジャッジ時間 | 5,434 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
int n; cin >> n;
vector<int> a(n), b(n);
for(auto&x:a) cin >> x;
for(auto&x:b) cin >> x;
int ans=1e9;
for(int i=0; i<n; i++){
priority_queue<P, vector<P>, greater<P>> pri;
for(auto p:a) pri.emplace(p, 0);
for(int j=0; j<n; j++){
int id=(i+j)%n;
auto [level, cnt]=pri.top(); pri.pop();
level+=b[id]/2, cnt++;
pri.emplace(level, cnt);
}
int now=-1;
while(pri.size()){
auto [_, x]=pri.top(); pri.pop();
now=max(now, x);
}
ans=min(ans, now);
}
cout << ans << endl;
return 0;
}