답안 #1044639

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1044639 2024-08-05T11:57:50 Z Kel_Mahmut 가로등 (APIO19_street_lamps) C++14
20 / 100
5000 ms 4372 KB
#include <bits/stdc++.h>
#define pb push_back
#define endl ("\n")
#define all(aa) aa.begin(), aa.end()
typedef long long ll;
using namespace std;

int main(){
	int n, q;
	cin >> n >> q;
	vector<int> v(n);
	string s;
	cin >> s;
	for(int i = 0; i < n; i++) v[i] = (s[i] == '1');

	vector<vector<int>> ans(n, vector<int>(n));
	for(int i = 0; i < q; i++){
		for(int j = 0; j < n; j++){
			for(int k = j; k < n; k++){
				int ok = 1;
				for(int a = j; a <= k; a++)
					ok &= v[a];
				ans[j][k] += ok;
			}
		}
		string t;
		cin >> t;
		if(t == "toggle"){
			int a; cin >> a; a--;
			v[a] ^= 1;
		}
		else{
			int l, r; cin >> l >> r; l--, r-= 2;
			cout << ans[l][r] << endl;
		}
	}

}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5039 ms 672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5029 ms 4184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5025 ms 4372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Execution timed out 5039 ms 672 KB Time limit exceeded
9 Halted 0 ms 0 KB -