QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#620275#9107. Zayin and CountLittleXiWA 329ms10528kbPython31.0kb2024-10-07 17:18:532024-10-07 17:18:55

Judging History

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

  • [2024-10-07 17:18:55]
  • 评测
  • 测评结果:WA
  • 用时:329ms
  • 内存:10528kb
  • [2024-10-07 17:18:53]
  • 提交

answer

tt = int(input())

def sw(s , k1 , k2):
    # print(s,k1,k2)
    y = 0
    s = s[::-1]
    for c in s:
        y = y * k1 + (ord(c) - ord('0'))
    res = 0
    # print(y)
    t = ""
    while y:
        t += chr(y%k2+ord('0'))
        y//=k2
        # break
    if len(t)==0:
        t = "0"
    return t

while tt:
    tt -= 1
    ls1 = list(map(int,input().split()))
    ls2 = list(map(int,input().split()))
    # print(ls1)
    s = input()
    s = s[::-1]
    mp = [0]*10
    ps = 0
    for i in range(len(ls1)):
        if ls1[i]:
            mp[i] = ps
            ps += 1
    # print(mp)

    # print(s)
    t = ""
    for c in s:
        # print(ord(c) - ord('0'))
        t += chr(mp[ord(c) - ord('0')] + ord('0'))

    anss = sw(t,sum(ls1),sum(ls2))
    # print(anss)
    anss = anss[::-1]
    mp = [0]*10
    ps = 0
    for i in range(10):
        if ls2[i]:
            mp[ps] = i
            ps +=1
    for c in anss:
        print(mp[ord(c)-ord('0')],end="")
    print()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 329ms
memory: 10528kb

input:

10000
1 0 0 0 1 1 0 0 0 1
0 0 1 0 1 1 1 1 0 0
950595954440050004054505054050
1 0 0 0 1 1 1 1 0 0
1 1 1 0 1 0 0 0 1 1
45467007076660767550460064
1 1 1 1 0 0 0 1 0 0
1 1 0 1 1 0 1 0 0 1
23373171320213300170200722
0 0 0 0 1 1 1 0 1 0
0 0 1 0 0 1 0 1 1 1
558565664666565565558468668484
1 1 0 0 1 0 1 0 1 ...

output:

65266455722475422254727242
41990991999414091249949
101364364636933104003903
57259252998225997772927975
878555885282288227752558252252
610010606760761011770006661017
68888858668556558688868865568855558868
51566165566155616511615666156611165656
505885888775005550558080707878
3333916221911699323366319
...

result:

wrong answer 1st lines differ - expected: '52755244567262766742575722', found: '65266455722475422254727242'