# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099516 | 2024-10-11T14:04:33 Z | Zero_OP | Street Lamps (APIO19_street_lamps) | C++14 | 5000 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; #define rep(i, l, r) for(int i = (l), _r = (r); i < _r; ++i) #define FOR(i, l, r) for(int i = (l), _r = (r); i <= _r; ++i) #define ROF(i, r, l) for(int i = (r), _l = (l); i >= _l; --i) #define all(v) begin(v), end(v) #define compact(v) v.erase(unique(all(v)), end(v)) #define sz(v) (int)v.size() #define dbg(x) "[" #x " = " << (x) << "]" template<typename T> bool minimize(T& a, const T& b){ if(a > b) return a = b, true; return false; } template<typename T> bool maximize(T& a, const T& b){ if(a < b) return a = b, true; return false; } using ll = long long; using ld = long double; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template<typename T> T random_int(T l, T r){ return uniform_int_distribution<T>(l, r)(rng); } template<typename T> T random_real(T l, T r){ return uniform_real_distribution<T>(l, r)(rng); } const int MAX = 3e5 + 5; const int inf = 1e9 + 9; int n, q; string s; set<pair<int, int>> onSegments; ll ans[MAX]; void testcase(){ cin >> n >> q >> s; s = '?' + s; vector<string> vers = {s}; vector<int> queries; FOR(t, 1, q){ string type; cin >> type; if(type == "toggle"){ int i; cin >> i; s[i] = '0' + (s[i] - '0') ^ 1; } else{ int l, r; cin >> l >> r; --r; int ans = 0; for(auto it : vers){ bool ok = true; FOR(i, l, r){ ok &= (it[i] == '1'); if(!ok) break; } ans += ok; } cout << ans << '\n'; } vers.push_back(s); } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #define filename "task" if(fopen(filename".inp", "r")){ freopen(filename".inp", "r", stdin); freopen(filename".ans", "w", stdout); } int T = 1; //cin >> T; while(T--) testcase(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5017 ms | 6084 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1372 KB | Output is correct |
2 | Correct | 7 ms | 1328 KB | Output is correct |
3 | Correct | 12 ms | 1372 KB | Output is correct |
4 | Correct | 81 ms | 1484 KB | Output is correct |
5 | Runtime error | 484 ms | 524288 KB | Execution killed with signal 9 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 1372 KB | Output is correct |
2 | Correct | 18 ms | 1372 KB | Output is correct |
3 | Correct | 13 ms | 1336 KB | Output is correct |
4 | Correct | 2 ms | 1496 KB | Output is correct |
5 | Runtime error | 222 ms | 524288 KB | Execution killed with signal 9 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Execution timed out | 5017 ms | 6084 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |