結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-04-21 22:17:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 295 ms / 5,000 ms |
コード長 | 1,065 bytes |
コンパイル時間 | 728 ms |
コンパイル使用メモリ | 85,988 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 22:34:26 |
合計ジャッジ時間 | 3,978 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include<sstream> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<numeric> #include<functional> #include<algorithm> using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) #define indexOf(v,x) (find(all(v),x)-v.begin()) int main(){ int n,a[1500],b[1500]; cin>>n; rep(i,n)cin>>a[i]; rep(i,n)cin>>b[i]; int ans=INF; rep(i,n){ int maxlv=0; priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq; rep(j,n)pq.push(make_pair(a[j],0)); pair<int,int> pi; for(int j=i;j<n;j++){ pi=pq.top(); pq.pop(); pi.first+=b[j]/2; pi.second++; pq.push(pi); maxlv=max(maxlv,pi.second); } for(int j=0;j<i;j++){ pi=pq.top(); pq.pop(); pi.first+=b[j]/2; pi.second++; pq.push(pi); maxlv=max(maxlv,pi.second); } ans=min(ans,maxlv); } cout<<ans<<endl; return 0; }