結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | tottoripaper |
提出日時 | 2014-11-16 03:16:02 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 340 ms / 5,000 ms |
コード長 | 1,043 bytes |
コンパイル時間 | 888 ms |
コンパイル使用メモリ | 47,908 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-06 03:13:04 |
合計ジャッジ時間 | 4,811 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 340 ms
4,376 KB |
testcase_03 | AC | 272 ms
4,380 KB |
testcase_04 | AC | 142 ms
4,380 KB |
testcase_05 | AC | 93 ms
4,380 KB |
testcase_06 | AC | 32 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 43 ms
4,380 KB |
testcase_09 | AC | 331 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 289 ms
4,376 KB |
testcase_12 | AC | 221 ms
4,376 KB |
testcase_13 | AC | 210 ms
4,376 KB |
testcase_14 | AC | 333 ms
4,376 KB |
testcase_15 | AC | 300 ms
4,376 KB |
testcase_16 | AC | 6 ms
4,380 KB |
testcase_17 | AC | 195 ms
4,380 KB |
testcase_18 | AC | 162 ms
4,376 KB |
testcase_19 | AC | 4 ms
4,380 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); }