結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
|
提出日時 | 2020-01-02 17:38:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 443 ms / 5,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 1,832 ms |
コンパイル使用メモリ | 173,716 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 18:13:23 |
合計ジャッジ時間 | 6,515 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; scanf("%d",&n); vector<int> a(n),b(n); rep(i,n) scanf("%d",&a[i]); rep(i,n) scanf("%d",&b[i]); int ans=n; rep(t,n){ priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q; rep(i,n) Q.emplace(a[i],0); rep(i,n){ auto p=Q.top(); Q.pop(); Q.emplace(p.first+b[(i+t)%n]/2,p.second+1); } int res=0; while(!Q.empty()) res=max(res,Q.top().second), Q.pop(); ans=min(ans,res); } printf("%d\n",ans); return 0; }