QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#126574 | #5158. Interview Question | esahc | WA | 13ms | 8128kb | Python3 | 824b | 2023-07-18 17:42:38 | 2023-07-18 17:42:39 |
Judging History
answer
from math import gcd, lcm
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:
b = gcd(FB[0], b)
a = FB[0]
if b == -1:
a = gcd(FB[0], a)
b = FB[0]
print(a,b)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 8088kb
input:
7 11 7 8 Fizz Buzz 11
output:
9 10
result:
ok
Test #2:
score: 0
Accepted
time: 13ms
memory: 8128kb
input:
49999 50002 49999 FizzBuzz 50001 Fizz
output:
2 50000
result:
ok
Test #3:
score: -100
Wrong Answer
time: 4ms
memory: 8088kb
input:
8 11 Buzz Buzz FizzBuzz Buzz
output:
10 2
result:
FAIL Mismatch at position 9: expected Buzz, got 9