結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
👑 |
| 提出日時 | 2022-09-11 17:30:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 319 ms / 5,000 ms |
| コード長 | 962 bytes |
| コンパイル時間 | 994 ms |
| コンパイル使用メモリ | 79,232 KB |
| 最終ジャッジ日時 | 2025-02-07 04:20:57 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct d{
int l,b;
bool operator==(const d a) const {
return l==a.l && b==a.b;
}
bool operator<(const d a) const {
if(l == a.l){
return b < a.b;
}
return l < a.l;
}
bool operator>(const d a) const {
return !(*this == a || *this < a);
}
};
int main(){
int n;cin>>n;
priority_queue<d,vector<d>,greater<d>> A;
vector<int> B(n);
for(int i = 0; n > i; i++){
cin>>B[i];
}
vector<int> C(n);
for(int i = 0; n > i; i++){
cin>>C[i];
}
int ans = n;
for(int i = 0; n > i; i++){
for(int j = 0; n > j; j++){
A.push({B[j],0});
}
for(int j = 0; n > j; j++){
auto z = A.top();A.pop();
z.l += C[(i+j)%n]/2;
z.b++;
A.push(z);
}
int tmp = 0;
while(A.size()){
auto z = A.top();A.pop();
tmp = max(tmp,z.b);
}
ans = min(ans,tmp);
}
cout << ans << endl;
}