結果

問題 No.1160 Strange Bowling
ユーザー kotatsugame
提出日時 2020-09-09 17:53:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 65,712 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-15 22:57:32
合計ジャッジ時間 3,494 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int N;
main()
{
	cin>>N;
	int A=0,B=-1e9;
	for(int i=0;i<N;i++)
	{
		int p,a,ta,tb;
		cin>>p>>a;
		ta=max(A+p,B+p+p);
		tb=max(A+a,B+a+a);
		A=ta;
		B=tb;
	}
	cout<<max(A,B)<<endl;
}
0