| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 919886 | vjudge1 | 원숭이와 사과 나무 (IZhO12_apple) | C++17 | 1 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
|---|---|---|---|---|
| Fetching results... | ||||
