結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2017-08-02 23:55:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,096 bytes |
コンパイル時間 | 2,422 ms |
コンパイル使用メモリ | 200,856 KB |
最終ジャッジ日時 | 2025-01-05 02:02:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 14 |
ソースコード
#include "bits/stdc++.h"using namespace std;int solve(int n, vector<int> a, vector<int> b, priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> partyInfo) {int res = 0;for (int i = 0; i < n; i++) {int fightNumMax = 0;priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq = partyInfo;for (int j = 0; j < n; j++) {int now = (i + j < n ? i + j : i + j - n);pair<int, int> player = pq.top(); pq.pop();player.first += b[now] / 2;player.second++;fightNumMax = max(fightNumMax, player.second);pq.push(player);}res = max(res, fightNumMax);}return res;}int main() {ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<int> a(n);for (int i = 0; i < n; i++) {cin >> a[i];}vector<int> b(n);for (int i = 0; i < n; i++) {cin >> b[i];}priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> partyInfo;for (int i = 0; i < n; i++) {partyInfo.push(make_pair(a[i], 0));}cout << solve(n, a, b, partyInfo) << endl;return 0;}