結果
| 問題 |
No.2762 Counting and Deleting
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2024-05-08 05:52:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 678 bytes |
| コンパイル時間 | 3,844 ms |
| コンパイル使用メモリ | 255,292 KB |
| 最終ジャッジ日時 | 2025-02-21 11:40:38 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 TLE * 1 -- * 5 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using mint = atcoder::modint998244353;
int main(){
int n, q;
cin >> n >> q;
string s;
cin >> s;
set<int> rest;
rep(i, n) rest.insert(i);
rep(i, q){
int t, l, r;
cin >> t >> l >> r;
l--; r--;
if(t == 1){
while(true){
auto it = rest.lower_bound(l);
if(it == rest.end()) break;
if(*it > r) break;
s[*it] = '_';
rest.erase(it);
}
}
if(t == 2){
mint f = 0;
mint g = 0;
for(int i = l; i <= r; i++){
if(s[i] == '0') f = f + g;
if(s[i] == '1') g = f + g + 1;
}
cout << (f + g).val() << "\n";
}
}
return 0;
}