QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#734237#9716. Code a Trieriad_alarefi#WA 11ms10456kbPython31.0kb2024-11-11 07:35:002024-11-11 07:35:00

Judging History

你现在查看的是最新测评结果

  • [2024-11-11 07:35:00]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:10456kb
  • [2024-11-11 07:35:00]
  • 提交

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: ''