結果
問題 |
No.2982 Logic Battle
|
ユーザー |
|
提出日時 | 2024-12-07 00:38:51 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 5,928 ms |
コンパイル使用メモリ | 312,944 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-07 00:38:58 |
合計ジャッジ時間 | 6,393 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 22 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using mint = atcoder::static_modint<998244353>; //using mint = atcoder::static_modint<1000000007>; using namespace std; using namespace atcoder; using ld = long double; using ll = long long; #define mp(a,b) make_pair(a,b) #define rep(i,s,n) for(int i=s; i<n; i++) const vector<int> dx{1,0,-1,0},dy{0,1,0,-1}; int main(){ int n;cin >> n; vector<vector<int>> a(n+1,vector<int>(3)); rep(i,1,n+1)rep(j,0,3)cin >> a[i][j]; vector<vector<pair<ll,ll>>> dp(n+1,vector<pair<ll,ll>>(3)); rep(i,1,n+1)rep(j,0,3)rep(k,0,3)if(j!=k){ int atk=dp[i-1][j].first+a[i][k]; pair<ll,ll> p=mp(max(0,atk-1),dp[i-1][j].second+atk); dp[i][k]=max(dp[i][k],p); } ll ans=0; rep(i,0,3)ans=max(ans,dp[n][i].second); cout <<ans; }