Submission
Status:
PPPPPPPTTTT
Subtask/Task Score:
70/100
Score: 70
User: purihorharin
Problemset: เปิดไฟ
Language: cpp
Time: 1.096 second
Submitted On: 2026-03-19 23:17:57
#include <iostream>
#include <bitset>
std::bitset<100000> light;
int main () {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
int n, m;
std::cin >> n >> m;
for (int i = 0; i < m; i++) {
int o, s, e;
std::cin >> o >> s >> e;
if (o == 0) {
for (int j = s - 1; j < e; j++) {
light[j] = !light[j];
}
} else {
int count = 0;
for (int j = s - 1; j < e; j++) {
count += light[j];
}
std::cout << count << "\n";
}
}
}