# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031911 | 2024-07-23T08:39:51 Z | KasymK | Street Lamps (APIO19_street_lamps) | C++17 | 1 ms | 348 KB |
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int MOD = 1e9+7; const int N = 1e2+5; int par[N], ans[N][N]; int main(){ freopen("file.txt", "r", stdin); int n, q; scanf("%d%d", &n, &q); string s; cin >> s; for(int i = 0; i < n; ++i) par[i+1] = par[i]+(s[i]-'0'); for(int i = 0; i < n; ++i) for(int j = i+1; j <= n; ++j) ans[i][j] = (par[j]-par[i] == j-i); while(q--){ string t; cin >> t; if (t == "query"){ int a, b; scanf("%d%d", &a, &b), a--, b--; printf("%d\n", ans[a][b]); } else{ int i; scanf("%d", &i), i--; s[i] = (s[i] == '0' ? '1' : '0'); } par[0] = 0; for(int i = 0; i < n; ++i) par[i+1] = par[i]+(s[i]-'0'); for(int i = 0; i < n; ++i) for(int j = i+1; j <= n; ++j) ans[i][j] += (par[j]-par[i] == j-i); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |