QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#126569#5158. Interview QuestionesahcWA 5ms8140kbPython3819b2023-07-18 17:34:462023-07-18 17:34:48

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-18 17:34:48]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:8140kb
  • [2023-07-18 17:34:46]
  • 提交

answer

from math import gcd

st, ed = map(int,input().split())

s = input().split()

a,b = -1, -1

FB = []
F = []
B = []

for i in range(st,ed+1):
    if s[i-st] == 'FizzBuzz':
        FB.append(i)
    elif s[i-st] == 'Fizz':
        F.append(i)
    elif s[i-st] == 'Buzz':
        B.append(i)

if len(FB) == 0:
    if len(F):
        a = F[0]
    if len(B):
        b = B[0]
        
    if a == -1:
        a = 1000000-1
    if b == -1:
        b = 1000000-1
else:
    if len(F):
        a = F[0]
    if len(B):
        b = B[0]
    
    if a == -1 and b == -1:
        a,b = FB[0], FB[0]
    else:
        if a == -1:
            a = gcd(FB[0], b)
            b = FB[0]
            
        if b == -1:
            b = gcd(FB[0], a)
            a = FB[0]
    
    
print(a,b)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 8088kb

input:

7 11
7 8 Fizz Buzz 11

output:

9 10

result:

ok 

Test #2:

score: -100
Wrong Answer
time: 5ms
memory: 8140kb

input:

49999 50002
49999 FizzBuzz 50001 Fizz

output:

50000 2

result:

FAIL Mismatch at position 50002: expected Fizz, got Buzz