結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-04-21 22:17:38 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 274 ms / 5,000 ms |
コード長 | 1,065 bytes |
コンパイル時間 | 549 ms |
使用メモリ | 3,576 KB |
最終ジャッジ日時 | 2023-01-21 14:25:40 |
合計ジャッジ時間 | 4,000 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,544 KB |
testcase_01 | AC | 2 ms
3,536 KB |
testcase_02 | AC | 274 ms
3,480 KB |
testcase_03 | AC | 219 ms
3,536 KB |
testcase_04 | AC | 114 ms
3,460 KB |
testcase_05 | AC | 75 ms
3,576 KB |
testcase_06 | AC | 26 ms
3,488 KB |
testcase_07 | AC | 2 ms
3,448 KB |
testcase_08 | AC | 34 ms
3,400 KB |
testcase_09 | AC | 269 ms
3,480 KB |
testcase_10 | AC | 2 ms
3,544 KB |
testcase_11 | AC | 206 ms
3,464 KB |
testcase_12 | AC | 166 ms
3,516 KB |
testcase_13 | AC | 149 ms
3,484 KB |
testcase_14 | AC | 271 ms
3,536 KB |
testcase_15 | AC | 245 ms
3,416 KB |
testcase_16 | AC | 5 ms
3,448 KB |
testcase_17 | AC | 157 ms
3,560 KB |
testcase_18 | AC | 131 ms
3,484 KB |
testcase_19 | AC | 4 ms
3,392 KB |
ソースコード
#include<sstream> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<numeric> #include<functional> #include<algorithm> using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) #define indexOf(v,x) (find(all(v),x)-v.begin()) int main(){ int n,a[1500],b[1500]; cin>>n; rep(i,n)cin>>a[i]; rep(i,n)cin>>b[i]; int ans=INF; rep(i,n){ int maxlv=0; priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq; rep(j,n)pq.push(make_pair(a[j],0)); pair<int,int> pi; for(int j=i;j<n;j++){ pi=pq.top(); pq.pop(); pi.first+=b[j]/2; pi.second++; pq.push(pi); maxlv=max(maxlv,pi.second); } for(int j=0;j<i;j++){ pi=pq.top(); pq.pop(); pi.first+=b[j]/2; pi.second++; pq.push(pi); maxlv=max(maxlv,pi.second); } ans=min(ans,maxlv); } cout<<ans<<endl; return 0; }