結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | monnu |
提出日時 | 2020-07-06 00:39:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 440 ms / 5,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 1,587 ms |
コンパイル使用メモリ | 174,020 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-24 14:42:34 |
合計ジャッジ時間 | 6,045 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 440 ms
4,348 KB |
testcase_03 | AC | 353 ms
4,348 KB |
testcase_04 | AC | 184 ms
4,348 KB |
testcase_05 | AC | 121 ms
4,348 KB |
testcase_06 | AC | 41 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 54 ms
4,348 KB |
testcase_09 | AC | 428 ms
4,348 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 367 ms
4,348 KB |
testcase_12 | AC | 294 ms
4,348 KB |
testcase_13 | AC | 198 ms
4,348 KB |
testcase_14 | AC | 429 ms
4,348 KB |
testcase_15 | AC | 391 ms
4,348 KB |
testcase_16 | AC | 8 ms
4,348 KB |
testcase_17 | AC | 250 ms
4,348 KB |
testcase_18 | AC | 210 ms
4,348 KB |
testcase_19 | AC | 5 ms
4,348 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; }