Submission #1044640

# Submission time Handle Problem Language Result Execution time Memory
1044640 2024-08-05T11:58:13 Z vjudge1 Street Lamps (APIO19_street_lamps) C++17
20 / 100
5000 ms 4188 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;
		}
	}

}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 7 ms 472 KB Output is correct
5 Correct 7 ms 348 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5028 ms 476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5052 ms 4188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5048 ms 4184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 7 ms 472 KB Output is correct
5 Correct 7 ms 348 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
8 Execution timed out 5028 ms 476 KB Time limit exceeded
9 Halted 0 ms 0 KB -