結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2016-12-13 17:53:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 447 ms / 5,000 ms |
コード長 | 1,480 bytes |
コンパイル時間 | 967 ms |
コンパイル使用メモリ | 100,700 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 23:47:17 |
合計ジャッジ時間 | 5,552 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <sstream> #include <cmath> #include <set> #include <iomanip> #include <deque> using namespace std; typedef long long ll; #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--) #define FOREACH(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++) #define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end()) #define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end()) #define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val)) #define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val)) #define PQUE priority_queue< pair<int,int>,vector< pair<int,int> >,greater< pair<int,int> > > int main(){ int N; cin>>N; vector<int> A(N),B(N); REP(i,N)cin>>A[i]; REP(i,N)cin>>B[i]; REP(i,N)B[i]/=2; int ans=1e9; REP(s,N){ PQUE que; REP(i,N)que.push(make_pair(A[i],0)); REP(i,N){ pair<int,int> t=que.top(); que.pop(); t.second++; t.first+=B[(i+s)%N]; que.push(t); } int anst=0; while(que.size()!=0){ anst=max(anst,que.top().second); que.pop(); } ans=min(ans,anst); } cout<<ans<<endl; return 0; }