結果
問題 | No.2219 Re:010 |
ユーザー |
![]() |
提出日時 | 2025-01-22 11:12:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,014 bytes |
コンパイル時間 | 1,595 ms |
コンパイル使用メモリ | 160,716 KB |
実行使用メモリ | 19,136 KB |
最終ジャッジ日時 | 2025-01-22 11:13:10 |
合計ジャッジ時間 | 51,245 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 16 |
ソースコード
#include <bits/stdc++.h> #define el "\n" #define sp " " #define fi first #define se second #define inf 1e18 #define r0 return 0 #define int long long #define F(i, a, b, c) for (int i = a; i <= b; i += c) #define debug printf ("bug is in here\n") #define TheEnd continue #define base(s) s = sp + s #define lcm(a, b) a * b / __gcd(a, b) #define setp(x) fixed << setprecision(x) #define p 998244353 using namespace std; typedef long long ll; typedef string str; using ull = unsigned ll; str s; int n; inline int g(void) { int z = 0, zo = 0, zoz = 0; F(i, 1, n, 1) { if (s[i] == '0') { z++; zoz += zo; } else { zo += z; } } return zoz; } inline int f(int x) { if (x == n + 1) { return g(); } if (s[x] != '?') { return f(x + 1); } s[x] = '0'; int z = f(x + 1); s[x] = '1'; int o = f(x + 1); s[x] = '?'; return (z + o) % p; } signed main(void) { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); cin >> s; n = s.size(); base(s); cout << f(1) << el; r0; }