Submission #970882

# Submission time Handle Problem Language Result Execution time Memory
970882 2024-04-27T12:58:17 Z mannshah1211 Street Lamps (APIO19_street_lamps) C++17
0 / 100
53 ms 3820 KB
/**
 *  author: hashman
 *  created:
**/

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> num(n);
  for (int i = 0; i < n; i++) {
    num[i] += s[i] - '0';
  }
  for (int i = 0; i < q; i++) {
    string op;
    cin >> op;
    if (op == "query") {
      int a, b;
      cin >> a >> b;
      cout << num[--a] << '\n';
    } else {
      int lamp;
      cin >> lamp;
      lamp--;
      s[lamp] = '1' + '0' - s[lamp];
    }
  }
}

// Cute is justice!
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 3820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -