結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-05-03 16:45:59 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 263 ms / 5,000 ms |
コード長 | 1,072 bytes |
コンパイル時間 | 583 ms |
使用メモリ | 5,160 KB |
最終ジャッジ日時 | 2023-01-21 14:27:08 |
合計ジャッジ時間 | 3,935 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,904 KB |
testcase_01 | AC | 1 ms
4,900 KB |
testcase_02 | AC | 263 ms
4,900 KB |
testcase_03 | AC | 209 ms
4,900 KB |
testcase_04 | AC | 110 ms
4,900 KB |
testcase_05 | AC | 71 ms
4,904 KB |
testcase_06 | AC | 25 ms
4,904 KB |
testcase_07 | AC | 2 ms
5,156 KB |
testcase_08 | AC | 32 ms
5,160 KB |
testcase_09 | AC | 257 ms
4,900 KB |
testcase_10 | AC | 1 ms
4,904 KB |
testcase_11 | AC | 200 ms
4,904 KB |
testcase_12 | AC | 166 ms
4,904 KB |
testcase_13 | AC | 143 ms
4,904 KB |
testcase_14 | AC | 257 ms
4,904 KB |
testcase_15 | AC | 233 ms
4,908 KB |
testcase_16 | AC | 5 ms
5,160 KB |
testcase_17 | AC | 150 ms
5,156 KB |
testcase_18 | AC | 125 ms
4,904 KB |
testcase_19 | AC | 3 ms
4,904 KB |
ソースコード
#include<iostream> #include<fstream> #include<sstream> #include<string> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<stack> #include<queue> #include<set> #include<map> #include<vector> #include<list> #include<algorithm> #include<utility> #include<complex> #include<functional> using namespace std; int a[1500], b[1500]; typedef pair<int, int> P; const int inf = 1e9; int main(void){ int N; cin >> N; for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; i++) { cin >> b[i]; b[i] >>= 1; } int res = inf; for (int i = 0; i < N; i++) { int maxim = 0; priority_queue< P ,vector<P>,greater<P>> que; for (int j = 0; j < N; j++) { que.push(make_pair(a[j], 0)); } for (int j = 0; j < N; j++){ int now = i + j; now = (now < N) ? now : now - N; auto p = que.top(); que.pop(); //printf("(%d,%d)-%d\n", p.first, p.second,b[now]); p.first += b[now]; p.second++; maxim = max(maxim, p.second); que.push(p); } res = min(res, maxim); } cout << res << endl; return 0; }