結果

問題 No.2889 Rusk
ユーザー winguwingu
提出日時 2024-09-13 22:35:29
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,948 bytes
コンパイル時間 3,185 ms
コンパイル使用メモリ 258,300 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2024-09-13 22:35:43
合計ジャッジ時間 12,412 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,820 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 2 ms
6,940 KB
testcase_50 AC 2 ms
6,944 KB
testcase_51 AC 2 ms
6,944 KB
testcase_52 AC 2 ms
6,940 KB
testcase_53 AC 2 ms
6,940 KB
testcase_54 AC 319 ms
9,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
#ifdef DEFINED_ONLY_IN_LOCAL
#include <dump.hpp>
#define dump(...) cpp_dump(__VA_ARGS__)
#else
#undef dump
#define dump(...)
#endif
#define rep1(i, a) for (int i = 0; i < a; i++)
#define rep2(i, a, b) for (int i = a; i < b; i++)
#define rep3(i, a, b, c) for (int i = a; i < b; i += c)
#define overloadRep(a, b, c, d, e, ...) e
#define rep(...) overloadRep(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define endl '\n'
using ll = long long;
using ull = unsigned long long;
const int inf = 1e9;
const ll INF = 1e18;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int ddx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int ddy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
struct cincout {cincout() {ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15);}} init;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T1, class T2> istream& operator>>(istream& is, pair<T1, T2>& p) {is >> p.first >> p.second; return is;}
template <class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) {os << p.first << " " << p.second << '\n'; return os;}
template <class T> istream& operator>>(istream& is, vector<T>& v) {for (T& in : v) {is >> in;} return is;}
template <class T> ostream& operator<<(ostream& os, const vector<T>& v) {rep(i, (int)v.size()) {os << v[i] << " \n"[i + 1 == (int)v.size()];} return os;}
template <class T> istream& operator>>(istream& is, vector<vector<T>>& vv) {for (vector<T>& v : vv) {is >> v;} return is;}
template <class T> ostream& operator<<(ostream& os, vector<vector<T>>& vv) {for (vector<T>& v : vv) {os << v;} return os;}
template <class T> inline T max(vector<T> x) {return *max_element(x.begin(), x.end());}
template <class T> inline T min(vector<T> x) {return *min_element(x.begin(), x.end());}
template <class T> inline T sum(vector<T> x) {return reduce(x.begin(), x.end());}
template <class... T> constexpr auto min(T... a) {return min(initializer_list<common_type_t<T...>>{a...});}
template <class... T> constexpr auto max(T... a) {return max(initializer_list<common_type_t<T...>>{a...});}
inline bool bit(ll x, int p) {return (x >> p) & 1;}
inline bool out(int ni, int nj, int h, int w) {return (ni < 0 or ni >= h or nj < 0 or nj >= w);}
inline int pc(ll x) {return __builtin_popcountll(x);}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
using P = pair<int, int>;
using T = tuple<int, int, int>;
int main() {
    int n;
    cin >> n;
    vector a(3, vector<ll>(n));
    cin >> a;
    vector dp(3, vector(3, vector<ll>(2, -INF)));
    dp[0][0][0] = 0;
    rep(i, n) {
        auto p = dp;
        swap(p, dp);
        rep(j, 3) rep(k, 3) rep(l, 2) {
            rep(nj, 3) rep(nk, 3) rep(nl, 2) {
                if (j == nj or nj == 0) {
                    if (k != nk or l != nl) continue;
                }
                int x = nj, y = nk, z = nl;
                if (j != nj and nj == 1) {
                    if (l >= 1 and j != 2) continue;
                    if (l != nl) continue;
                    if (k + 1 != nk) continue;
                }
                if (j != nj and nj == 2) {
                    if (k >= 2 and j != 1) continue;
                    if (k != nk) continue;
                    if (l + 1 != nl) continue;
                }
                if (chmax(dp[x][y][z], p[j][k][l] + a[x][i]) and dp[x][y][z] == 11) {
                    dump(i);
                    dump(j, k, l);
                    dump(x, y, z);
                }
            }
        }
    }
    ll ans = 0;
    rep(i, 3) rep(j, 3) rep(k, 2) chmax(ans, dp[i][j][k]);
    cout << ans << endl;
    return 0;
}
0