Submission #254815

# Submission time Handle Problem Language Result Execution time Memory
254815 2020-07-30T16:01:44 Z Lawliet Street Lamps (APIO19_street_lamps) C++17
20 / 100
3 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[1];
 
	for(int i = 1 ; i <= q ; i++)
	{
		string type;
		cin >> type;
 
		v[i + 1] = v[i];
 
		if( type == "toggle" )
		{
			int ind;
			cin >> ind; ind--;
 
			if( v[i][ind] == '1' ) v[i + 1][ind] = '0';
			else v[i + 1][ind] = '1';
		}
		if( type == "query" )
		{
			int l, r;
			cin >> l >> r; l--; r--;
 
			int ans = 0;
 
			for(int t = 1 ; 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 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
# 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 3 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 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -