QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#126577 | #5158. Interview Question | esahc | WA | 18ms | 8188kb | Python3 | 848b | 2023-07-18 17:46:42 | 2023-07-18 17:46:43 |
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(F):
a = F[0]
for i in F[1:]:
a = gcd(a,i)
if len(B):
b = B[0]
for i in B[1:]:
b = gcd(b,i)
if len(FB) == 0:
if a == -1:
a = 1000000-1
if b == -1:
b = 1000000-1
else:
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: 18ms
memory: 8136kb
input:
7 11 7 8 Fizz Buzz 11
output:
9 10
result:
ok
Test #2:
score: 0
Accepted
time: 14ms
memory: 8188kb
input:
49999 50002 49999 FizzBuzz 50001 Fizz
output:
2 50000
result:
ok
Test #3:
score: 0
Accepted
time: 9ms
memory: 8088kb
input:
8 11 Buzz Buzz FizzBuzz Buzz
output:
10 1
result:
ok
Test #4:
score: 0
Accepted
time: 13ms
memory: 8076kb
input:
10 15 10 11 12 13 14 15
output:
999999 999999
result:
ok
Test #5:
score: 0
Accepted
time: 6ms
memory: 8072kb
input:
17 17 17
output:
999999 999999
result:
ok
Test #6:
score: 0
Accepted
time: 5ms
memory: 8168kb
input:
13 13 Fizz
output:
13 999999
result:
ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 8088kb
input:
20 20 Buzz
output:
999999 20
result:
ok
Test #8:
score: 0
Accepted
time: 9ms
memory: 8128kb
input:
30 30 FizzBuzz
output:
30 30
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 8140kb
input:
9 10 Buzz FizzBuzz
output:
10 1
result:
ok
Test #10:
score: 0
Accepted
time: 13ms
memory: 8084kb
input:
2 6 2 3 4 5 FizzBuzz
output:
6 6
result:
ok
Test #11:
score: 0
Accepted
time: 3ms
memory: 8140kb
input:
6 7 Fizz 7
output:
6 999999
result:
ok
Test #12:
score: 0
Accepted
time: 13ms
memory: 8116kb
input:
7 8 Buzz Buzz
output:
999999 1
result:
ok
Test #13:
score: 0
Accepted
time: 5ms
memory: 8188kb
input:
4 8 4 5 Buzz 7 8
output:
999999 6
result:
ok
Test #14:
score: -100
Wrong Answer
time: 13ms
memory: 8128kb
input:
33 50 Buzz 34 35 FizzBuzz 37 38 Buzz 40 41 FizzBuzz 43 44 Buzz 46 47 FizzBuzz 49 50
output:
36 3
result:
FAIL Mismatch at position 42: expected FizzBuzz, got Buzz