Submission #41999202


Source Code Expand

def C():
    import re

    N = int(input())
    S = input()

    ms = re.finditer("o+", S)

    l = N
    r = 0
    for m in ms:
        l1, r1 = m.span()
        if r1 - l1 > r - l:
            l = l1
            r = r1
            
    if (0 < l < N and S[l - 1] == "-") or (0 < r < N and S[r] == "-"):
        print(r - l)
    else:
        print(-1)
        
C()

Submission Info

Submission Time
Task C - Dango
User arakaki_tokyo
Language PyPy3 (7.3.0)
Score 300
Code Size 388 Byte
Status AC
Exec Time 106 ms
Memory 75376 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 29
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 03_handmade_17.txt, 03_handmade_18.txt, 03_handmade_19.txt, 03_handmade_20.txt, 03_handmade_21.txt, 03_handmade_22.txt, 03_handmade_23.txt, 03_handmade_24.txt, 03_handmade_25.txt, 03_handmade_26.txt, 03_handmade_27.txt, 03_handmade_28.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 106 ms 70468 KiB
00_sample_01.txt AC 66 ms 70664 KiB
00_sample_02.txt AC 67 ms 70404 KiB
01_small_03.txt AC 65 ms 70600 KiB
01_small_04.txt AC 66 ms 70612 KiB
01_small_05.txt AC 64 ms 70472 KiB
01_small_06.txt AC 65 ms 70712 KiB
01_small_07.txt AC 64 ms 70432 KiB
02_random_08.txt AC 85 ms 75376 KiB
02_random_09.txt AC 78 ms 75112 KiB
02_random_10.txt AC 77 ms 75252 KiB
02_random_11.txt AC 78 ms 74804 KiB
02_random_12.txt AC 75 ms 74660 KiB
02_random_13.txt AC 74 ms 74668 KiB
02_random_14.txt AC 74 ms 74728 KiB
02_random_15.txt AC 75 ms 74668 KiB
02_random_16.txt AC 75 ms 74772 KiB
03_handmade_17.txt AC 67 ms 71408 KiB
03_handmade_18.txt AC 68 ms 71068 KiB
03_handmade_19.txt AC 68 ms 70824 KiB
03_handmade_20.txt AC 82 ms 75024 KiB
03_handmade_21.txt AC 67 ms 72040 KiB
03_handmade_22.txt AC 69 ms 72144 KiB
03_handmade_23.txt AC 67 ms 72044 KiB
03_handmade_24.txt AC 90 ms 75260 KiB
03_handmade_25.txt AC 69 ms 71852 KiB
03_handmade_26.txt AC 64 ms 71804 KiB
03_handmade_27.txt AC 67 ms 71824 KiB
03_handmade_28.txt AC 70 ms 71556 KiB