QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#734237 | #9716. Code a Trie | riad_alarefi# | WA | 11ms | 10456kb | Python3 | 1.0kb | 2024-11-11 07:35:00 | 2024-11-11 07:35:00 |
Judging History
answer
MOD = 10**9 + 7
def solve():
import sys
input = sys.stdin.read
data = input().split()
index = 0
T = int(data[index])
index += 1
results = []
for t in range(T):
n = int(data[index])
m = int(data[index + 1])
k = int(data[index + 2])
index += 3
heights = list(map(int, data[index:index + n + m]))
index += (n + m)
conditions = []
for _ in range(k):
x = int(data[index]) - 1
y = int(data[index + 1]) - 1
h = int(data[index + 2])
conditions.append((x, y, h))
index += 3
# Initialize the number of ways
ways = 1
for i in range(n):
for j in range(m):
# Calculate the available ways for each cell
ways = (ways * (heights[i + j] + 1)) % MOD
results.append(f"Case #{t + 1}: {ways}")
print('\n'.join(results))
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 11ms
memory: 10456kb
input:
6 2 aa 1 a 2 1 a 1 3 aa 1 ab 1 ac 1 2 aa 1 ac 2 3 aaa 1 ac 1 aa 3 3 aa 1 ac 1 a 3
output:
result:
wrong answer 1st lines differ - expected: 'Case #1: 3', found: ''