結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2014-11-16 03:16:02 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 334 ms / 5,000 ms |
コード長 | 1,043 bytes |
コンパイル時間 | 308 ms |
使用メモリ | 5,156 KB |
最終ジャッジ日時 | 2023-01-21 13:45:00 |
合計ジャッジ時間 | 4,515 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,900 KB |
testcase_01 | AC | 2 ms
5,156 KB |
testcase_02 | AC | 334 ms
4,904 KB |
testcase_03 | AC | 269 ms
4,900 KB |
testcase_04 | AC | 140 ms
5,156 KB |
testcase_05 | AC | 91 ms
4,904 KB |
testcase_06 | AC | 32 ms
4,900 KB |
testcase_07 | AC | 2 ms
5,156 KB |
testcase_08 | AC | 42 ms
5,152 KB |
testcase_09 | AC | 330 ms
4,900 KB |
testcase_10 | AC | 1 ms
5,156 KB |
testcase_11 | AC | 284 ms
5,156 KB |
testcase_12 | AC | 217 ms
4,904 KB |
testcase_13 | AC | 208 ms
4,904 KB |
testcase_14 | AC | 329 ms
4,904 KB |
testcase_15 | AC | 297 ms
4,904 KB |
testcase_16 | AC | 6 ms
4,900 KB |
testcase_17 | AC | 192 ms
4,904 KB |
testcase_18 | AC | 161 ms
4,900 KB |
testcase_19 | AC | 4 ms
4,900 KB |
ソースコード
#include <cstdio> #include <vector> #include <queue> #define mp std::make_pair typedef std::pair<int,int> P; typedef std::pair<P, int> State; int main(){ int N; scanf("%d", &N); int A[1500], B[1500]; for(int i=0;i<N;i++){scanf("%d", A+i);} for(int i=0;i<N;i++){scanf("%d", B+i);} int res = 1500; for(int first=0;first<N;first++){ int counter[1500]; std::fill(counter, counter+1500, 0); std::priority_queue<State, std::vector<State>, std::greater<State>> q; for(int i=0;i<N;i++){q.push(mp(mp(A[i], 0), i));} for(int i=0;i<N;i++){ State s = q.top(); q.pop(); int index = (first+i) % N; q.push(mp(mp(s.first.first+B[index]/2, s.first.second+1), s.second)); counter[s.second] += 1; } int mx = 0; for(int i=0;i<N;i++){ mx = std::max(mx, counter[i]); } res = std::min(res, mx); } printf("%d\n", res); }