結果
| 問題 | No.663 セルオートマトンの逆操作 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-20 23:01:17 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 2,000 ms |
| + 5µs | |
| コード長 | 850 bytes |
| 記録 | |
| コンパイル時間 | 4,936 ms |
| コンパイル使用メモリ | 382,024 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-11-20 23:01:33 |
| 合計ジャッジ時間 | 6,544 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using mint = modint1000000007;
int f(int a, int b, int c) {
return (a and b and c) or (!b and !c) ? 0 : 1;
}
int main() {
int n;
cin >> n;
vector<int> e(n);
rep(i, n) cin >> e[i];
mint ans;
rep(s, 4) {
vector<mint> dp(4);
dp[s] = 1;
rep(i, n) {
vector<mint> old(4);
dp.swap(old);
rep(t, 4) {
int a = t/2, b = t%2;
rep(c, 2) {
if (f(a, b, c) == e[i]) {
dp[b*2+c] += old[t];
}
}
}
}
ans += dp[s];
}
cout << ans.val() << '\n';
return 0;
}