Submission #919886

#TimeUsernameProblemLanguageResultExecution timeMemory
919886vjudge1Monkey and Apple-trees (IZhO12_apple)C++17
0 / 100
1 ms344 KiB
#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 timeMemoryGrader output
Fetching results...