結果

問題 No.3070 Collecting Coins Speedrun 2
ユーザー MM
提出日時 2025-03-21 21:59:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 3,850 ms
コンパイル使用メモリ 251,520 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-21 22:00:02
合計ジャッジ時間 5,416 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;

int main(){
	// input + prep
	int N;
	cin >> N;
	int neg = 0, pos = 0, zero = 0;
	
	for(int i = 0; i < N; i++){
		int x;
		cin >> x;
		if(x < 0) neg++;
		if(x > 0) pos++;
		if(x == 0) zero++;
	}
	
	// solve
	mint ans = 1;
	for(int i = 0; i < neg - 1; i++) ans *= 2;
	for(int i = 0; i < pos - 1; i++) ans *= 2;
	if(neg > 0 && pos > 0) ans *= 2;
	if(zero) ans *= int(neg > 0) + int(pos > 0) + 1;
	
	// output
	cout << ans.val() << endl;
}
0