結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | Sounds_Of_Rain |
提出日時 | 2015-07-20 12:12:56 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 214 ms / 5,000 ms |
コード長 | 978 bytes |
コンパイル時間 | 634 ms |
コンパイル使用メモリ | 81,988 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-06 03:54:58 |
合計ジャッジ時間 | 3,274 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 214 ms
4,376 KB |
testcase_03 | AC | 168 ms
4,380 KB |
testcase_04 | AC | 92 ms
4,376 KB |
testcase_05 | AC | 61 ms
4,376 KB |
testcase_06 | AC | 22 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 28 ms
4,380 KB |
testcase_09 | AC | 207 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 143 ms
4,376 KB |
testcase_12 | AC | 108 ms
4,380 KB |
testcase_13 | AC | 107 ms
4,380 KB |
testcase_14 | AC | 214 ms
4,376 KB |
testcase_15 | AC | 188 ms
4,380 KB |
testcase_16 | AC | 5 ms
4,380 KB |
testcase_17 | AC | 119 ms
4,376 KB |
testcase_18 | AC | 99 ms
4,376 KB |
testcase_19 | AC | 3 ms
4,376 KB |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cstring> #include <cmath> #include <vector> #include <list> #include <string> #include <set> #include <map> #include <queue> #include <stack> #include <algorithm> #include <iostream> #include <sstream> using namespace std; typedef long long int llint; const int INF = 1000000; const llint LINF = 100000000; int main(){ int A[1500]; int B[1500]; int n,ans = INF; priority_queue<pair<int, int>>st; cin >> n; for (int i = 0; i < n; i++){ cin >> A[i]; st.push(make_pair(-A[i],0)); } for (int i = 0; i < n; i++){ cin >> B[i]; } for (int i = 0; i < n; i++){ int cc = 0; priority_queue<pair<int, int>>pq = st; for (int j = i; j < n+i; j++){ pair<int, int> P = pq.top(); pq.pop(); P.second--; if (j < n){ P.first -= B[j] / 2; } else{ P.first -= B[j - n] / 2; } pq.push(P); cc = max(cc, -P.second); } ans = min(cc, ans); } cout << ans << endl; return 0; }