結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー karinohito
提出日時 2025-03-21 22:47:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 193,476 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-21 22:47:31
合計ジャッジ時間 3,300 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h> 
using namespace std;

using ll=long long;
#include<atcoder/modint>
using namespace atcoder;
using mint=modint998244353;


int main(){
	
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll N;
	cin>>N;
	ll P=0,Q=0;
	for(int i=0;i<N;i++){
		ll C;
		cin>>C;
		(C>0?P:Q)=max((C>0?P:Q),abs(C));
	}
	cout<<(P+Q)*2<<endl;
}

0