Submission #1095028

#TimeUsernameProblemLanguageResultExecution timeMemory
1095028vjudge1Street Lamps (APIO19_street_lamps)C++17
20 / 100
5039 ms524288 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cassert> #include <cstring> #include <set> #include <functional> #warning That's not the baby, that's my baby #define debug(x) #x << " = " << x << '\n' using ll = long long; const int INF = 1e9; const int NMAX = 3e5; std::string s; int n; std::vector<std::string> ss; int query(int l, int r) { int answer = 0; for (const auto &q : ss) { bool ok = true; for (int i = l; i <= r && ok; i++) { ok &= q[i]; } answer += ok; } return answer; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int q; std::cin >> n >> q; std::cin >> s; s = '$' + s; for (int i = 1; i <= n; i++) { s[i] -= '0'; } ss.push_back(s); for (int i = 1; i <= q; i++) { std::string type; std::cin >> type; if (type == "toggle") { int p; std::cin >> p; s[p] ^= 1; } else { int l, r; std::cin >> l >> r; r--; std::cout << query(l, r) << '\n'; } ss.push_back(s); } return 0; }

Compilation message (stderr)

street_lamps.cpp:8:2: warning: #warning That's not the baby, that's my baby [-Wcpp]
    8 | #warning That's not the baby, that's my baby
      |  ^~~~~~~
#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...