#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define S second
#define F first
#define all(x) (x).begin(),(x).end()
#define sz size()
#define Yes cout << "YES" << endl
#define No cout << "NO" << endl
#define pb(x) push_back(x);
#define endl '\n'
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int N=101+7;
ll INF=INT_MAX,mod=1e9+7;
int TT=1;
ll power(ll x, unsigned int y)
{
ll res = 1;
x = x; // % mod;
if (x == 0) return 0;
while (y > 0)
{
if (y & 1) res = (res*x) ; // % mod;
y = y>>1;
x = (x*x) ; // % mod;
}
return res;
}
ll dp[N][N];
ll n , q;
string s;
void solve()
{
cin >> n >> q;
cin >> s;
for(int i = 1; i <= n; i++)
{
bool ok = 1;
for(int j = i+1; j <= n+1; j++)
{
if(s[j-2]=='0') ok = 0;
if(ok) dp[i][j]++;
}
}
while(q--)
{
string ttt; cin >> ttt;
if(ttt[0]=='q')
{
ll x, y; cin >> x >> y; cout << dp[x][y] << endl;
}
else
{
ll x; cin >> x;
if(s[x-1]=='1') s[x-1] = '0'; else s[x-1] = 1;
}
for(int i = 1; i <= n; i++)
{
bool ok = 1;
for(int j = i+1; j <= n+1; j++)
{
if(s[j-2]=='0') ok = 0;
if(ok) dp[i][j]++;
}
}
}
}
int main(){
//freopen("friday.in","r",stdin);
//freopen("friday.out","w",stdout);
fast;
while(TT--)
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1530 ms |
4660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |