結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-07-06 00:39:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 442 ms / 5,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 1,697 ms |
コンパイル使用メモリ | 173,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-23 07:02:11 |
合計ジャッジ時間 | 6,223 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using Graph=vector<vector<int>>; #define MOD 1000000007 #define INF 1000000000 int main(){ int N; cin>>N; vector<int> A(N),B(N); for(int i=0;i<N;i++){ cin>>A[i]; } for(int i=0;i<N;i++){ cin>>B[i]; } int ans=INF; for(int i=0;i<N;i++){ priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; for(int j=0;j<N;j++){ pair<int,int> p=make_pair(A[j],0); pq.push(p); } for(int j=0;j<N;j++){ pair<int,int> p=pq.top(); pq.pop(); int k=(i+j)%N; p.first+=B[k]/2; p.second+=1; pq.push(p); } int count=0; while(!pq.empty()){ pair<int,int> p=pq.top(); pq.pop(); count=max(count,p.second); } ans=min(count,ans); } cout<<ans<<endl; }