시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1.5 초 | 1024 MB | 12 | 4 | 4 | 33.333% |
You wake up as usual and, during the day, you start noticing certain glitches in the world. By the end of the day, you are sure you are in the Matrix and you want to get out. The Architect finds you and offers you a way out if you manage to aid him in a problem.
The Architect has an N × M matrix, where initially all of the cells are 0. During the day, parts of the matrix are modified and sometimes the Architect wants to find something about a certain cell in the matrix.
The Architect tells you that the matrix has N rows and M columns, then he sends you K operations as follows:
Because the Architect doesn't trust you completely, this problem is NOT going to be judged the usual batch way. Instead, you have to implement the following functions:
void initialize(long long N, long long M)
void update(long long X, long long Y1, long long Y2)
int query(long long X, long long Y)
in your source file, with these exact prototypes. You may implement other functions and declare local and global variables. Your submissions must not interact in any way with standard input/output, nor with any other file. Do not declare a main function. Your source file will be compiled and linked together with a source file provided by the committee, which will handle the input/output and will call the functions your source file has declared (grader.cpp).
번호 | 배점 | 제한 |
---|---|---|
1 | 20 | N, M ≤ 1000; K ≤ 100 |
2 | 30 | N, M ≤ 100,000; K ≤ 100,000 |
3 | 50 | none |
2 5 0 2 2 4 1 2 3 0 2 1 5 1 2 2 0 1 2 2 1 1 2
1 2 1
After the last operation, the matrix looks like this:
0 1 0 0 0 1 2 2 2 1
C++17, C++20, C++17 (Clang), C++20 (Clang)