QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693155#8340. 3 SumBambi#RE 236ms11168kbPython3446b2024-10-31 15:38:062024-10-31 15:38:21

Judging History

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

  • [2024-10-31 15:38:21]
  • 评测
  • 测评结果:RE
  • 用时:236ms
  • 内存:11168kb
  • [2024-10-31 15:38:06]
  • 提交

answer

from collections import defaultdict


def solve():
    n, k = map(int, input().split())
    m = pow(10, k) - 1
    a = [0] * n
    for i in range(n):
        a[i] = int(input()) % m
    d = defaultdict(int)
    ans = 0
    for i in range(n):
        d.clear()
        for j in range(i, n):
            d[a[j]] += 1
            ans += d[((m - a[i] - a[j]) % m + m) % m]
    print(ans)


if __name__ == '__main__':
    solve()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 13ms
memory: 10644kb

input:

4 1
0
1
10
17

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 236ms
memory: 11168kb

input:

500 859
7118711592236878297922359501613604144948355616986970837340677671376753603836852811886591300370143151943368529129749813118476151865844255212534355441611481420938483178075143062691345257288242460282715389758789648541099090735875617822348551942134616963557723055980260082230902505269975518146286...

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: -100
Dangerous Syscalls

input:

500 17336
11871159223687829792235950161360414494835561698697083734067767137675360383685281188659130037014315194336852912974981311847615186584425521253435544161148142093848317807514306269134525728824246028271538975878964854109909073587561782234855194213461696355772305598026008223090250526997551814628...

output:


result: