結果

問題 No.1682 Unfair Game
ユーザー 沙耶花
提出日時 2021-09-17 22:00:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 4,438 ms
コンパイル使用メモリ 252,200 KB
最終ジャッジ日時 2025-01-24 14:56:25
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
 
 
int main(){
	
	int n;
	cin>>n;
	
	vector<int> p(n);
	rep(i,n)cin>>p[i];
	
	vector<mint> dp(2,0);
	dp[0] = 1;
	
	rep(i,n){
		vector<mint> ndp(2,0);
		rep(j,2){
			ndp[j] += dp[j];
			int nj = j;
			if(p[i]==50)continue;
			if(p[i]>50)nj ^= 1;
			ndp[nj] += dp[j];
		}
		swap(dp,ndp);
	}
	
	cout<<dp[1].val()<<endl;
	
	return 0;
}
0