답안 #254813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
254813 2020-07-30T16:00:18 Z Lawliet 가로등 (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[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--;

			if( v[i][ind] == '1' ) v[i][ind] = '0';
			else v[i][ind] = '1';
		}
		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++;
			}

			cout << ans << endl;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 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 -