# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
914769 | Namkhing | Digital Circuit (IOI22_circuit) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "circuit"
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> val;
void init(int N, int M, std::vector<int> P, std::vector<int> A) {
n = N, m = M;
for (int i = 0; i < M; i++) {
val.push_back(A[i]);
}
}
int count_ways(int L, int R) {
int l = L - n, r = R - n, total = 0;
for (int i = l; i <= r; i++) {
val[i] ^= 1;
}
for (int i = 0; i < m; i++) {
total += val[i];
}
return total;
}