結果

問題 No.45 回転寿司
ユーザー 唐澤貴洋
提出日時 2015-10-13 00:58:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 501 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 68,220 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 12:28:41
合計ジャッジ時間 2,137 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<bitset>
#include<array>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstdlib>
#define D long long
#define U unsigned
using namespace std;
D n, m,a, b, d, e, x, y, z;
D i, j, k;
char c;
D ma[2];
int main() {
	D t,u;
	cin >> a;
	for (i = 0; i < a; i++) {
		cin >> t;
		u = ma[0];
		ma[0] = max(ma[0],ma[1]);
		ma[1] = u + t;
	}
	cout << max(ma[0], ma[1]) << endl;
}
0