結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
|
提出日時 | 2018-09-30 18:25:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 330 ms / 5,000 ms |
コード長 | 937 bytes |
コンパイル時間 | 893 ms |
コンパイル使用メモリ | 105,540 KB |
最終ジャッジ日時 | 2025-01-06 14:13:01 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include<iostream> #include<vector> #include<map> #include<algorithm> #include<cmath> #include<queue> #include<numeric> static int const INF{100000000}; int main(int, char**) { int n; std::cin >> n; std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, std::greater<std::pair<int, int>>> as{}; std::vector<int> bs(n); for(int i{}; i < n; ++i) { int a; std::cin >> a; as.emplace(a, 0); } for(int i{}; i < n; ++i) { std::cin >> bs[i]; } int min{10000000}; for(int i{}; i < n; ++i) { auto nas = as; for(int j{}; j < n; ++j) { int vsl = bs[(j + i) % n]; auto nt = nas.top(); nas.pop(); nt.first += vsl / 2; nt.second += 1; nas.push(nt); } int m{}; for(int i{}; i < n; ++i) { m = std::max(m, nas.top().second); nas.pop(); } min = std::min(min, m); } std::cout << min <<std::endl; return 0; }