結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | h_noson |
提出日時 | 2016-06-19 20:05:56 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 277 ms / 5,000 ms |
コード長 | 927 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 73,884 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-06 04:42:13 |
合計ジャッジ時間 | 4,029 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 277 ms
4,380 KB |
testcase_03 | AC | 219 ms
4,380 KB |
testcase_04 | AC | 115 ms
4,384 KB |
testcase_05 | AC | 77 ms
4,380 KB |
testcase_06 | AC | 27 ms
4,384 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 35 ms
4,380 KB |
testcase_09 | AC | 271 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 206 ms
4,380 KB |
testcase_12 | AC | 185 ms
4,376 KB |
testcase_13 | AC | 137 ms
4,380 KB |
testcase_14 | AC | 273 ms
4,380 KB |
testcase_15 | AC | 246 ms
4,380 KB |
testcase_16 | AC | 6 ms
4,380 KB |
testcase_17 | AC | 158 ms
4,376 KB |
testcase_18 | AC | 132 ms
4,376 KB |
testcase_19 | AC | 3 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <queue> using namespace std; #define REP(i,s,e) for (i = s; i <= e; i++) #define rep(i,n) REP (i,0,(int)(n)-1) #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP (i,(int)(n)-1,0) #define INF (int)1e8 #define MOD (int)(1e9+7) typedef long long ll; int main(void) { int i, n; int a[1500], b[1500]; cin >> n; rep (i,n) cin >> a[i]; rep (i,n) cin >> b[i]; int s, ans = INF; rep (s,n) { int count = 0; priority_queue<pair<int,int>> q; // (-level,-count) rep (i,n) q.push(make_pair(-a[i],0)); rep (i,n) { auto p = q.top(); q.pop(); p.first -= b[(s+i)%n]/2; p.second--; count = max(count,-p.second); q.push(p); } ans = min(count,ans); } cout << ans << endl; return 0; }