Submission #798583

#TimeUsernameProblemLanguageResultExecution timeMemory
798583gg123_peStreet Lamps (APIO19_street_lamps)C++14
20 / 100
1 ms468 KiB
#include <bits/stdc++.h> using namespace std; #define f(i,a,b) for(int i = a; i < b; i++) const int N = 3e5 + 5, M = 105; int n, q; int a[M][M]; string s; void subtask_1(){ f(i,1,q+1){ f(j,1,n+1) a[i][j] = a[i-1][j]; string ty; int x, y; cin >> ty; if(ty[0] == 'q'){ cin >> x >> y; // cuantos tiempos el rango [x, y-1] suma 0 int ans = 0; f(j,0,i){ int sum = 0; f(r,x,y) sum += a[j][r]; if(sum == 0) ans++; } cout << ans << "\n"; } else{ cin >> x; a[i][x] = 1 - a[i][x]; } } } int main(){ cin >> n >> q; cin >> s; f(i,0,n){ if(s[i] == '0') a[0][i+1] = 1; else a[0][i+1] = 0; } if(n <= 100){ subtask_1(); return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...