結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2016-11-07 16:19:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 408 ms / 5,000 ms |
コード長 | 1,374 bytes |
コンパイル時間 | 768 ms |
コンパイル使用メモリ | 81,284 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 23:45:19 |
合計ジャッジ時間 | 4,810 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <cmath> #include <vector> #include <array> #include <queue> #include <set> #include <map> #include <sstream> // istringstream #include <algorithm> // sort #include <utility> // pair #include <cfloat> // DBL_MAX typedef long long ll; using namespace std; // const int maxN = 200000; // bool ps[maxN-1]; int main(){ ll N; // [1500] cin >> N; priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > party; vector<int> monster(N); for(int i=0; i<N; i++){ int tmp; cin >> tmp; party.push(make_pair(tmp,0)); } for(int i=0; i<N; i++){ cin >> monster[i]; } // main int minmaxb = 2000; // > 1500 // for from each monster begin, for(int i=0; i<N; i++){ priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > sim(party); // the result becomes, for(int j=0; j<N; j++){ sim.push(make_pair(sim.top().first+monster[(i+j)%N]/2, sim.top().second+1)); sim.pop(); } // max battle is, int maxb = 0; while(!sim.empty()){ maxb = max(maxb, sim.top().second); //cout << sim.top().first<<" "<<sim.top().second<<","; sim.pop(); } minmaxb = min(minmaxb, maxb); } cout << minmaxb << endl; return 0; }