Submit solution
Points:
7 (partial)
Time limit:
0.1s
Java
0.3s
Python 2
0.3s
Python 3
0.3s
Memory limit:
256M
Problem type
Given a sequence of integers and a nonnegative integer , count the number of pairs that satisfy the following two conditions: , and .
Input Specification
- The first line contains integers and , separated by a space.
- The second line contains integers, which denotes .
- In of the test cases, .
Output Specification
- The output contains an integer, which denotes the number of pairs that satisfy the two conditions.
- If the output is smaller than , please keep it as is. Otherwise, output the number mod .
Sample Input 1
5 6
1 2 3 4 5
Sample Output 1
6
Sample Input 2
5 12
3 6 8 2 8
Sample Output 2
7
Explanation: In Sample 1, among the pairs, , , , , , satisfy the conditions. In Sample 2, , , , , , , satisfy the conditions.
Comments
What am I doing wrong for the last test cases? Keep getting WA.
You are outputting your answers mod instead of by mod . Your code,
counter%(10000000000+7)
, has one extra zero.If you want to avoid similar issues in the future, try defining a global variable for your "mod" constant for consistency.
Such as with
int mod = 1e9+7;
in C++. So, usecounter%mod
in that case.Thanks! I completely missed that one.
This comment is hidden due to too much negative feedback. Show it anyway.
I thought you said you were good enough to qualify for IOI 2022
again, hes just smurfing and pretending to be bad. smh. He's guaranteed ioi 2022 watch.
This comment is hidden due to too much negative feedback. Show it anyway.
So solutions like yours can't pass. Find a more efficient way to solve the problem.