結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2018-12-30 23:16:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 398 ms / 5,000 ms |
コード長 | 1,415 bytes |
コンパイル時間 | 1,065 ms |
コンパイル使用メモリ | 101,048 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 07:55:04 |
合計ジャッジ時間 | 5,132 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <set> #include <cmath> #include <stack> #include <algorithm> #include <iomanip> #include <map> #include <queue> #include <functional> #include <numeric> using ll = long long; using namespace std; const ll MOD = 1e9 + 7; int A[1510], B[1510]; bool operator<(const pair<int, int> &a, const pair<int, int> &b) { if (a.first == b.first) return a.second < b.second; return a.first < b.first; }; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; int main(void) { int N; cin >> N; for (int i = 0; i < N; ++i) { cin >> A[i]; pq.push(make_pair(A[i], 0)); } for (int i = 0; i < N; ++i) cin >> B[i]; int ans = 100000; for (int i = 0; i < N; ++i) { priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq2 = pq; int idx = 0; while (idx != N) { pair<int, int> p = pq2.top(); pq2.pop(); p.first += B[(i + idx) % N] / 2; p.second += 1; pq2.push(p); idx++; } int maxV = 0; while (pq2.size()) { pair<int, int> p = pq2.top(); pq2.pop(); maxV = max(maxV, p.second); } ans = min(ans, maxV); } cout << ans << endl; return 0; }