#include <iostream>
#include <vector>
int main() {
int M;
std::cin >> M;
std::vector<bool> ripen; // true if apple tree is red-ripen, false otherwise
int C = 0; // the amount of red-ripen apple-trees Chris has counted
while (M--) {
int D, X, Y;
std::cin >> D >> X >> Y;
if (D == 1) { // Chris's arrival
int count = 0;
for (int i = X + C - 1; i <= Y + C - 1; i++) {
if (ripen[i]) {
count++;
}
}
std::cout << count << std::endl;
C = count;
} else if (D == 2) { // red-ripening of apple-trees
for (int i = X + C - 1; i <= Y + C - 1; i++) {
ripen[i] = true;
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |