結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-07-06 00:39:02 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 432 ms / 5,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 1,418 ms |
使用メモリ | 6,952 KB |
最終ジャッジ日時 | 2022-11-23 00:00:46 |
合計ジャッジ時間 | 6,515 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,900 KB |
testcase_01 | AC | 1 ms
6,952 KB |
testcase_02 | AC | 432 ms
6,948 KB |
testcase_03 | AC | 349 ms
4,900 KB |
testcase_04 | AC | 182 ms
4,904 KB |
testcase_05 | AC | 119 ms
6,948 KB |
testcase_06 | AC | 41 ms
6,948 KB |
testcase_07 | AC | 2 ms
4,904 KB |
testcase_08 | AC | 54 ms
4,904 KB |
testcase_09 | AC | 426 ms
4,908 KB |
testcase_10 | AC | 1 ms
6,948 KB |
testcase_11 | AC | 355 ms
4,900 KB |
testcase_12 | AC | 301 ms
4,900 KB |
testcase_13 | AC | 219 ms
6,952 KB |
testcase_14 | AC | 428 ms
4,904 KB |
testcase_15 | AC | 384 ms
6,952 KB |
testcase_16 | AC | 8 ms
4,900 KB |
testcase_17 | AC | 249 ms
6,952 KB |
testcase_18 | AC | 206 ms
6,948 KB |
testcase_19 | AC | 5 ms
4,904 KB |
ソースコード
#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; }