結果
問題 | No.2889 Rusk |
ユーザー | nono00 |
提出日時 | 2024-09-13 21:51:21 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,699 bytes |
コンパイル時間 | 3,078 ms |
コンパイル使用メモリ | 254,588 KB |
実行使用メモリ | 25,128 KB |
最終ジャッジ日時 | 2024-09-13 21:51:33 |
合計ジャッジ時間 | 7,508 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 3 ms
6,940 KB |
testcase_02 | AC | 3 ms
6,940 KB |
testcase_03 | AC | 3 ms
6,940 KB |
testcase_04 | AC | 3 ms
6,944 KB |
testcase_05 | AC | 3 ms
6,940 KB |
testcase_06 | AC | 3 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 3 ms
6,944 KB |
testcase_09 | AC | 3 ms
6,940 KB |
testcase_10 | WA | - |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 3 ms
6,944 KB |
testcase_13 | AC | 3 ms
6,944 KB |
testcase_14 | AC | 8 ms
6,944 KB |
testcase_15 | AC | 17 ms
6,940 KB |
testcase_16 | AC | 42 ms
12,288 KB |
testcase_17 | AC | 13 ms
6,944 KB |
testcase_18 | AC | 35 ms
10,828 KB |
testcase_19 | AC | 68 ms
17,856 KB |
testcase_20 | AC | 84 ms
21,360 KB |
testcase_21 | AC | 68 ms
18,108 KB |
testcase_22 | AC | 58 ms
16,020 KB |
testcase_23 | AC | 70 ms
13,240 KB |
testcase_24 | AC | 83 ms
21,136 KB |
testcase_25 | AC | 46 ms
13,088 KB |
testcase_26 | AC | 67 ms
17,792 KB |
testcase_27 | AC | 85 ms
22,060 KB |
testcase_28 | AC | 51 ms
14,236 KB |
testcase_29 | AC | 53 ms
14,592 KB |
testcase_30 | AC | 52 ms
14,564 KB |
testcase_31 | AC | 85 ms
21,736 KB |
testcase_32 | AC | 37 ms
11,144 KB |
testcase_33 | AC | 12 ms
6,944 KB |
testcase_34 | AC | 99 ms
25,060 KB |
testcase_35 | AC | 98 ms
25,128 KB |
testcase_36 | AC | 98 ms
25,068 KB |
testcase_37 | AC | 98 ms
25,000 KB |
testcase_38 | AC | 98 ms
25,116 KB |
testcase_39 | AC | 60 ms
23,092 KB |
testcase_40 | AC | 48 ms
18,644 KB |
testcase_41 | AC | 63 ms
24,016 KB |
testcase_42 | AC | 45 ms
17,500 KB |
testcase_43 | AC | 21 ms
9,832 KB |
testcase_44 | AC | 56 ms
21,764 KB |
testcase_45 | AC | 44 ms
17,216 KB |
testcase_46 | AC | 13 ms
7,084 KB |
testcase_47 | AC | 24 ms
10,492 KB |
testcase_48 | AC | 51 ms
19,780 KB |
testcase_49 | AC | 2 ms
6,944 KB |
testcase_50 | AC | 2 ms
6,944 KB |
testcase_51 | WA | - |
testcase_52 | AC | 2 ms
6,940 KB |
testcase_53 | AC | 2 ms
6,944 KB |
testcase_54 | AC | 103 ms
24,984 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; template <class T> using max_heap = priority_queue<T>; template <class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; #define rep(i, l, r) for (ll i = (l); i < (r); i++) #define rrep(i, r, l) for (ll i = (r); i-- > (l);) #define all(x) begin(x), end(x) template <class T> bool chmin(T& lhs, T rhs) { return lhs > rhs ? (lhs = rhs, true) : false; } template <class T> bool chmax(T& lhs, T rhs) { return lhs < rhs ? (lhs = rhs, true) : false; } struct IOIO { IOIO() { cin.tie(0)->sync_with_stdio(0); } } ioio; template <class S, class T> ostream& operator<<(ostream& os, const pair<S, T>& p) { os << '(' << p.first << ", " << p.second << ')'; return os; } template <class T> ostream& operator<<(ostream& os, const vector<T>& vs) { os << '{'; rep(i, 0, (int)vs.size()) os << vs[i] << (i + 1 == (int)vs.size() ? "" : ", "); os << '}'; return os; } template <class T> ostream& operator<<(ostream& os, const set<T>& vs) { os << '{'; for (auto it = vs.begin(); it != vs.end(); it++) { if (it != vs.begin()) { os << ", "; } os << *it; } os << '}'; return os; } template <class T, class U> ostream& operator<<(ostream& os, const map<T, U>& vs) { os << '{'; for (auto it = vs.begin(); it != vs.end(); it++) { if (it != vs.begin()) { os << ", "; } os << *it; } os << '}'; return os; } #ifdef DEBUG void dump_func() { cerr << endl; } template <class Head, class... Tail> void dump_func(Head&& head, Tail&&... tail) { cerr << head; if (sizeof...(Tail) > 0) { cerr << ", "; } dump_func(std::move(tail)...); } #define dump(...) cerr << "[" + string(#__VA_ARGS__) + "] ", dump_func(__VA_ARGS__) #else #define dump(...) static_cast<int>(0) #endif int main() { int n; cin >> n; vector a(3, vector<ll>(n)); rep(i, 0, n) cin >> a[0][i]; rep(i, 0, n) cin >> a[1][i]; rep(i, 0, n) cin >> a[2][i]; constexpr ll inf = 1e18; vector dp(n + 1, vector<ll>(6, -inf)); vector to(6, vector<int>(6, -1)); to[0][0] = 0; to[0][1] = 1; to[1][1] = 1; to[1][2] = 0; to[1][4] = 2; to[2][2] = 0; to[2][3] = 1; to[3][3] = 1; to[3][5] = 0; to[4][4] = 2; to[4][3] = 1; to[4][5] = 0; to[5][5] = 0; dp[0][0] = 0; rep(i, 0, n) { rep(j, 0, 6) { if (dp[i][j] == -inf) continue; rep(k, 0, 6) { if (to[j][k] != -1) { chmax(dp[i + 1][k], dp[i][j] + a[to[j][k]][i]); } } } } cout << *max_element(all(dp[n])) << '\n'; }