結果
| 問題 |
No.2541 Divide 01 String
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-24 21:30:03 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 913 bytes |
| コンパイル時間 | 5,429 ms |
| コンパイル使用メモリ | 307,548 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 08:53:42 |
| 合計ジャッジ時間 | 5,937 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 5 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
template <class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const int INF = INT_MAX / 2;
const ll LINF = 1LL << 60;
const vector<int> dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};
using mint = modint998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
string s;
cin >> s;
int r = 0;
mint ans = 1;
for (int l = 0; l < n;) {
if (s[l] == '0') {
l++;
r++;
} else {
r++;
while (r < n && s[r] == '0') {
r++;
}
if (r == n) {
break;
} else {
ans *= (r - l + 1);
l = r;
}
}
}
cout << ans.val() << '\n';
return 0;
}