PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000235. XOR hình chữ nhật tĩnh (Static Rectangle XOR)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
XOR hình chữ nhật tĩnh (Static Rectangle XOR)
Static Rectangle XOR
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a static matrix of nonnegative integers, each query asks for the bitwise XOR of all cells in the inclusive rectangle. Indices are 1-based.
Input
The first line contains , followed by rows of integers and lines of .
Output
Print one rectangle XOR per query.
Subtasks
- Subtask 1 (30 points): ; ; ; ; ; .
- Subtask 2 (30 points): ; ; ; ; ; ; .
- Subtask 3 (40 points): ; ; ; ; ; .
Example 1
Input
2 2 1
1 2
3 4
1 1 2 2
Output
4
Explanation
The full rectangle XOR is 1 XOR 2 XOR 3 XOR 4 = 4.
Example 2
Input
1 3 2
7 7 0
1 1 1 2
1 2 1 2
Output
0
7
Explanation
The two sevens cancel; the second query contains a single seven.