QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#126569 | #5158. Interview Question | esahc | WA | 5ms | 8140kb | Python3 | 819b | 2023-07-18 17:34:46 | 2023-07-18 17:34:48 |
Judging History
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