結果
問題 | No.949 飲酒プログラミングコンテスト |
ユーザー | 東前頭十一枚目 |
提出日時 | 2019-12-19 11:07:29 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,379 bytes |
コンパイル時間 | 1,570 ms |
コンパイル使用メモリ | 168,848 KB |
実行使用メモリ | 109,748 KB |
最終ジャッジ日時 | 2023-09-21 06:37:14 |
合計ジャッジ時間 | 7,483 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,412 KB |
testcase_01 | AC | 2 ms
7,404 KB |
testcase_02 | AC | 2 ms
7,436 KB |
testcase_03 | AC | 2 ms
7,452 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 243 ms
89,812 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 154 ms
76,604 KB |
testcase_16 | AC | 289 ms
97,440 KB |
testcase_17 | AC | 42 ms
43,544 KB |
testcase_18 | AC | 349 ms
102,308 KB |
testcase_19 | AC | 167 ms
84,948 KB |
testcase_20 | AC | 38 ms
43,400 KB |
testcase_21 | AC | 14 ms
26,724 KB |
testcase_22 | AC | 24 ms
37,068 KB |
testcase_23 | AC | 6 ms
15,600 KB |
testcase_24 | AC | 186 ms
79,620 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 319 ms
100,560 KB |
testcase_28 | AC | 366 ms
104,276 KB |
testcase_29 | AC | 245 ms
99,348 KB |
testcase_30 | AC | 135 ms
86,168 KB |
testcase_31 | AC | 95 ms
74,872 KB |
testcase_32 | AC | 333 ms
102,172 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; const int MAX = 3010; int dp[MAX][MAX]; int solve[MAX][MAX]; int ans[MAX][MAX]; int main() { int n; cin >> n; int a[n + 1]; for(int i = 0; i <= n; ++i) cin >> a[i]; int b[n + 1]; for(int i = 0; i <= n; ++i) cin >> b[i]; int d[n]; for(int i = 0; i < n; ++i) cin >> d[i]; sort(d, d + n); reverse(d, d + n); dp[0][0] = a[0] + b[0]; solve[0][0] = -1; ans[0][0] = 0; for(int i = 0; i <= n; ++i) { for(int j = 0; j <= n; ++j) { if(i == 0 and j == 0) continue; if(i - 1 >= 0) { dp[i][j] = dp[i - 1][j] - a[i - 1] + a[i]; int ng = solve[i - 1][j], ok = n; while(abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if(d[mid] <= dp[i][j]) { ok = mid; } else { ng = mid; } } solve[i][j] = ok; if(solve[i][j] != n) { ans[i][j] = ans[i - 1][j] + 1; } } if(j - 1 >= 0) { dp[i][j] = dp[i][j - 1] - b[j - 1] + b[j]; int ng = solve[i][j - 1], ok = n; while(abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if(d[mid] <= dp[i][j]) { ok = mid; } else { ng = mid; } } solve[i][j] = ok; if(solve[i][j] != n) { ans[i][j] = ans[i][j - 1] + 1; } } } } int anss = 0; for(int i = 0; i <= n; ++i) { for(int j = 0; j <= n; ++j) { anss = max(anss, ans[i][j]); } } cout << anss << '\n'; return 0; }