結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー cotton_fn_cotton_fn_
提出日時 2020-02-02 18:44:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,500 ms
コード長 1,248 bytes
コンパイル時間 1,206 ms
コンパイル使用メモリ 124,484 KB
実行使用メモリ 37,824 KB
最終ジャッジ日時 2023-10-19 01:23:09
合計ジャッジ時間 4,154 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
6,016 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
6,032 KB
testcase_08 AC 4 ms
8,112 KB
testcase_09 AC 3 ms
6,036 KB
testcase_10 AC 3 ms
6,048 KB
testcase_11 AC 66 ms
35,136 KB
testcase_12 AC 66 ms
35,136 KB
testcase_13 AC 60 ms
33,088 KB
testcase_14 AC 11 ms
14,392 KB
testcase_15 AC 44 ms
28,992 KB
testcase_16 AC 77 ms
37,204 KB
testcase_17 AC 13 ms
16,476 KB
testcase_18 AC 86 ms
37,508 KB
testcase_19 AC 55 ms
35,136 KB
testcase_20 AC 15 ms
18,560 KB
testcase_21 AC 6 ms
12,312 KB
testcase_22 AC 10 ms
16,496 KB
testcase_23 AC 3 ms
8,128 KB
testcase_24 AC 48 ms
31,040 KB
testcase_25 AC 91 ms
37,824 KB
testcase_26 AC 90 ms
37,824 KB
testcase_27 AC 86 ms
37,824 KB
testcase_28 AC 89 ms
37,824 KB
testcase_29 AC 77 ms
37,824 KB
testcase_30 AC 43 ms
37,824 KB
testcase_31 AC 27 ms
37,824 KB
testcase_32 AC 91 ms
37,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int n, a[3001], b[3001], d[3001];
int dp[3001][3001];
int main() {
    cin >> n;
    for (int i = 0; i <= n; ++i) cin >> a[i];
    for (int i = 0; i <= n; ++i) cin >> b[i];
    for (int i = 1; i <= n; ++i) cin >> d[i];
    sort(&d[1], &d[n + 1]);
    int ans = 0;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j + i <= n; ++j) {
            if (i == 0 && j == 0) {
                dp[i][j] = n + 1;
                continue;
            }
            int k = 0;
            if (i > 0) k = max(k, dp[i - 1][j]);
            if (j > 0) k = max(k, dp[i][j - 1]);
            auto l = lower_bound(&d[0], &d[k], a[i] + b[j] + 1) - &d[0] - 1;
            dp[i][j] = l;
            if (dp[i][j] >= 1) {
                ans = max(ans, i + j);
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0