結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2019-05-01 22:10:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,067 bytes |
コンパイル時間 | 1,167 ms |
コンパイル使用メモリ | 84,436 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-31 12:41:59 |
合計ジャッジ時間 | 2,104 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 30 |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <string> #include <algorithm> #include <iomanip> #include <map> #include <bitset> #include <cstdio> #include <set> #include <stack> #include <queue> #include <cassert> #include <numeric> #define rep(i,n) Rep(i,0,n) #define Rep(i,k,n) for(int i=k ; i<n ; i++) #define rep1(i,n) for(int i=1 ; i<=n ; i++) #define vi vector<int> #define vii vector<vector<int>> #define mii map<int,int> #define Sort(v) sort(v.begin(),v.end()) #define Reverse(v) reverse(v.begin(),v.end()) #define ALL(a) (a).begin(),(a).end() #define pb push_back #define mp make_pair //#define int ll typedef long long ll; const int md = 1000000007; const int INF = 1<<30; using namespace std; int main(){ int n; cin >> n; vi a(n); rep(i,n) cin >> a[i]; int dp[n+1][2]; rep(i,n+1) rep(j,2) dp[i][j] = 0; rep(i,n){ dp[i+1][1] = dp[i][0] + a[i]; dp[i+1][0] = max(dp[i][1],dp[i][0]); } cout << dp[n][0] << " " << dp[n][1] << endl; cout << max(dp[n][0],dp[n][1]) << endl; }