結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
|
提出日時 | 2020-09-11 13:08:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 429 ms / 5,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 3,414 ms |
コンパイル使用メモリ | 176,412 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 20:26:02 |
合計ジャッジ時間 | 6,884 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < n; ++i) using ll = long long; using P = pair<int,int>; int main() { priority_queue<P,vector<P>,greater<P>> que; int N;cin>>N; rep(i,N){ int Ai;cin>>Ai; que.push({Ai,0}); } priority_queue<P,vector<P>,greater<P>> def=que; vector<int>B; rep(i,N){ int Bi;cin>>Bi; Bi/=2; B.push_back(Bi); } int ans=1500; rep(j,N){ que=def; rep(i,N){ P now=que.top(); que.pop(); now={now.first+B[(i+j)%N],now.second+1}; que.push(now); } int max_battle=0; while(!que.empty()){ max_battle=max(max_battle,que.top().second); que.pop(); } ans=min(ans,max_battle); } cout<<ans<<endl; }