結果

問題 No.45 回転寿司
ユーザー nmnmnmnmnmnmnm
提出日時 2014-10-19 17:24:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 871 bytes
コンパイル時間 1,702 ms
コンパイル使用メモリ 85,472 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 10:38:58
合計ジャッジ時間 1,660 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))

#define MOD 1000000007

int main(){
  int N;
  cin>>N;
  int a = 0;
  int b = 0;
  rep(i,0,N){
    int v;
    cin>>v;
    int a1 = b+v;
    int b1 = max(a,b);
    a = a1;
    b = b1;
  }
  cout << max(a,b) << endl;
  return 0;
}
0