QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#770600#9536. Athlete Welcome CeremonyJEdwardWA 14ms10736kbPython31.6kb2024-11-21 22:34:212024-11-21 22:34:21

Judging History

This is the latest submission verdict.

  • [2024-11-21 22:34:21]
  • Judged
  • Verdict: WA
  • Time: 14ms
  • Memory: 10736kb
  • [2024-11-21 22:34:21]
  • Submitted

answer

def main():
    import sys
    sys.setrecursionlimit(1 << 25)
    MOD = 10**9 + 7

    n, Q = map(int, sys.stdin.readline().split())
    s = sys.stdin.readline().strip()
    queries = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]

    # Precompute the number of valid assignments without considering counts
    dp = [dict() for _ in range(n+1)]
    dp[0][''] = 1
    for i in range(n):
        for last, cnt in dp[i].items():
            if s[i] != '?':
                c = s[i]
                if last != c:
                    key = c
                    if key in dp[i+1]:
                        dp[i+1][key] = (dp[i+1][key] + cnt) % MOD
                    else:
                        dp[i+1][key] = cnt % MOD
            else:
                for c in ['a', 'b', 'c']:
                    if last != c:
                        key = c
                        if key in dp[i+1]:
                            dp[i+1][key] = (dp[i+1][key] + cnt) % MOD
                        else:
                            dp[i+1][key] = cnt % MOD
    total = (sum(dp[n].values()) % MOD)

    # Precompute the number of assignments where a >= k, b >= l, c >= m
    # Placeholder for the actual precomputation logic
    # ...

    # For each query, compute the valid count using inclusion-exclusion
    for x, y, z in queries:
        # Placeholder for inclusion-exclusion calculation
        # ...
        # Compute valid using inclusion-exclusion
        valid = total  # Replace with actual inclusion-exclusion result
        print(valid % MOD)

if __name__ == '__main__':
    main()

詳細信息

Test #1:

score: 0
Wrong Answer
time: 14ms
memory: 10736kb

input:

6 3
a?b??c
2 2 2
1 1 1
1 0 2

output:

3
3
3

result:

wrong answer 2nd lines differ - expected: '1', found: '3'