Submission #254810

# Submission time Handle Problem Language Result Execution time Memory
254810 2020-07-30T15:57:26 Z Lawliet Street Lamps (APIO19_street_lamps) C++17
0 / 100
2 ms 640 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 110;

int n, q;

string v[MAXN];

int main()
{
	cin >> n >> q;
	cin >> v[0];

	for(int i = 1 ; i <= q ; i++)
	{
		string type;
		cin >> type;

		v[i] = v[i - 1];

		if( type == "toggle" )
		{
			int ind;
			cin >> ind; ind--;

			v[i][ind] = '1' - v[i][ind];
		}
		if( type == "query" )
		{
			int l, r;
			cin >> l >> r; l--; r--;

			int ans = 0;

			for(int t = 0 ; t < i ; t++)
			{
				bool flag = true;

				for(int j = l ; j < r ; j++)
					if( v[t][j] == '0' ) flag = false;

				if( flag ) ans++;
			}

			printf("%d\n",ans);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -