#P5614. [MtOI2019] 膜Siyuan
[MtOI2019] 膜Siyuan
Background
You are strong if you are strong, but is stronger than you. ——.
Recently, disangan233 found a game for OIers: Mo .
He was confused by “Truth IV” in it, so he came to you for help.
Problem Description
You are given positive integer and positive-integer triples . Please find the number of all ordered positive-integer triples that satisfy:
$$\forall i\leq n ,s.t.~|a_i-x|\oplus |b_i-y|\oplus |c_i-z| = 9$$Here, means “for all”, means “such that”, and is the XOR of .
In C++, A^B^C or A xor B xor C is exactly the value of .
A template is provided here:
if ((a ^ b ^ c) == 9)
{
Your code here...
}
For two ordered triples , if or or , then and are considered different.
Input Format
There are lines in total.
The first line contains positive integers and .
In the next lines, the -th line contains positive integers .
Output Format
There is line in total. Output non-negative integer, which is the required answer.
5 200
21 84 198
38 47 102
44 47 132
63 150 166
76 79 132
4
Hint
Sample Explanation 1
All that satisfy the conditions are:
, , , and .
There are in total.
Subtasks
For of the data, it is guaranteed to be exactly the same as the sample.
For of the data, it is guaranteed that .
For all data, it is guaranteed that and .
Source
Problem setter: disangan233.
Problem tester: Studying Father.
Translated by ChatGPT 5