結果
問題 | No.2219 Re:010 |
ユーザー |
![]() |
提出日時 | 2025-01-22 13:45:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,383 bytes |
コンパイル時間 | 1,564 ms |
コンパイル使用メモリ | 162,952 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2025-01-22 13:46:15 |
合計ジャッジ時間 | 10,492 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 RE * 16 TLE * 2 |
ソースコード
#include <bits/stdc++.h> #define ll long long #define N 200001 #define mod 998244353 #define all(a) a.begin(),a.end() #define uniqueu(a) a.erase(unique(all(a)), a.end()) using namespace std; mt19937_64 mrand(random_device{}()); int n; string s, str; ll ans; inline void dfs(int p) { if (p == n) { for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) for (int k = j + 1; k < n; k++) if (str[i] == '0' && str[j] == '1' && str[k] == '0') ans++; return; } if (s[p] != '?') { str[p] = s[p]; dfs(p + 1); } else { str[p] = '0'; dfs(p + 1); str[p] = '1'; dfs(p + 1); } } inline void solve(void) { cin >> s; n = (int)(s.size()); int tot = 0; for (auto &i : s) if (i != '?') tot++; if (tot == n) { for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) for (int k = j + 1; k < n; k++) if (s[i] == '0' && s[j] == '1' && s[k] == '0') ans++; cout << ans % mod << "\n"; return; } dfs(0); cout << ans % mod << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int Test = 1; //cin >> Test; for ( ; Test--; ) { solve(); } }