QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#219367#5158. Interview Questiongramolis#WA 15ms9156kbPython31.0kb2023-10-19 13:32:442023-10-19 13:32:45

Judging History

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

  • [2023-10-19 13:32:45]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:9156kb
  • [2023-10-19 13:32:44]
  • 提交

answer



c, d = list(map(int, input().split()))

buzz = []
fizz = []
fizz_buzz = []

s = input().split()

for i in range(c, d + 1):

    if s[i-c] == 'Fizz':
        fizz.append(i)
    elif s[i-c] == 'Buzz':
        buzz.append(i)
    
    if s[i-c] == 'FizzBuzz':
        fizz_buzz.append(i)
        fizz.append(i)
        buzz.append(i)



a = 1000000
b = 999999


# we know both for sure
if len(buzz) >= 2 and len(fizz) >= 2:
    a = fizz[-2] - fizz[-1]
    b = buzz[-2] - buzz[-1]

# we only know buzz
elif len(buzz) >= 2:
    b = buzz[-1] - buzz[-2]
    if len(fizz_buzz):
        a = fizz_buzz[0] // b
    elif len(fizz):
        a = fizz[0]

# we only know fizz
elif len(fizz) >= 2:
    a = fizz[-1] - fizz[-2]
    if len(fizz_buzz):
        b = fizz_buzz[0] // a
    elif len(buzz):
        b = buzz[0]

# we don't know neither
elif len(fizz_buzz):
    a = fizz_buzz[0]
    b = fizz_buzz[0]

else:
    if len(fizz):
        a = fizz[0]
    if len(buzz):
        b = buzz[0]


print(a, b)







Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 9156kb

input:

7 11
7 8 Fizz Buzz 11

output:

9 10

result:

ok 

Test #2:

score: 0
Accepted
time: 14ms
memory: 9036kb

input:

49999 50002
49999 FizzBuzz 50001 Fizz

output:

2 25000

result:

ok 

Test #3:

score: 0
Accepted
time: 7ms
memory: 9032kb

input:

8 11
Buzz Buzz FizzBuzz Buzz

output:

10 1

result:

ok 

Test #4:

score: 0
Accepted
time: 9ms
memory: 9028kb

input:

10 15
10 11 12 13 14 15

output:

1000000 999999

result:

ok 

Test #5:

score: 0
Accepted
time: 14ms
memory: 9032kb

input:

17 17
17

output:

1000000 999999

result:

ok 

Test #6:

score: 0
Accepted
time: 10ms
memory: 9092kb

input:

13 13
Fizz

output:

13 999999

result:

ok 

Test #7:

score: 0
Accepted
time: 11ms
memory: 9040kb

input:

20 20
Buzz

output:

1000000 20

result:

ok 

Test #8:

score: 0
Accepted
time: 13ms
memory: 9080kb

input:

30 30
FizzBuzz

output:

30 30

result:

ok 

Test #9:

score: 0
Accepted
time: 13ms
memory: 9104kb

input:

9 10
Buzz FizzBuzz

output:

10 1

result:

ok 

Test #10:

score: 0
Accepted
time: 13ms
memory: 9156kb

input:

2 6
2 3 4 5 FizzBuzz

output:

6 6

result:

ok 

Test #11:

score: 0
Accepted
time: 11ms
memory: 9156kb

input:

6 7
Fizz 7

output:

6 999999

result:

ok 

Test #12:

score: 0
Accepted
time: 15ms
memory: 9024kb

input:

7 8
Buzz Buzz

output:

1000000 1

result:

ok 

Test #13:

score: 0
Accepted
time: 12ms
memory: 9104kb

input:

4 8
4 5 Buzz 7 8

output:

1000000 6

result:

ok 

Test #14:

score: -100
Wrong Answer
time: 9ms
memory: 9096kb

input:

33 50
Buzz 34 35 FizzBuzz 37 38 Buzz 40 41 FizzBuzz 43 44 Buzz 46 47 FizzBuzz 49 50

output:

-6 -3

result:

wrong answer Integer parameter [name=a] equals to -6, violates the range [1, 1000000]