AtCoder Regular Contest 022

Submission #2574118

Source codeソースコード

def main():
    n = int(input())
    a = [int(x) for x in input().split()]

    l, r = 0, 0
    ans = 0
    while r < n:
        v = a[l:r + 1]
        if len(v) == len(set(v)):
            r += 1
            ans = max(ans, r - l)
        elif l == r:
            l += 1
            r += 1
        else:
            l += 1
        # print('l={}, r={}, size={}, {}'.format(l, r, r - l, v))
    print(ans)


if __name__ == '__main__':
    main()

Submission

Task問題 B - 細長いお菓子
User nameユーザ名 xkumiyu
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 TLE
Score得点 99
Source lengthソースコード長 466 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
Subtask1 50 / 50 sample_01.txt,sample_02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt
Subtask2 49 / 49 sample_01.txt,sample_02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt
Subtask3 0 / 1 sample_01.txt,sample_02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask3_01.txt,subtask3_02.txt,subtask3_03.txt,subtask3_04.txt,subtask3_05.txt,subtask3_06.txt,subtask3_07.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 17 ms 3060 KB
sample_02.txt AC 17 ms 3060 KB
subtask1_01.txt AC 17 ms 2936 KB
subtask1_02.txt AC 17 ms 3064 KB
subtask1_03.txt AC 17 ms 3060 KB
subtask1_04.txt AC 17 ms 2940 KB
subtask1_05.txt AC 17 ms 3060 KB
subtask1_06.txt AC 17 ms 3060 KB
subtask1_07.txt AC 17 ms 3060 KB
subtask1_08.txt AC 19 ms 3060 KB
subtask1_09.txt AC 17 ms 3064 KB
subtask1_10.txt AC 17 ms 3060 KB
subtask1_11.txt AC 17 ms 3060 KB
subtask1_12.txt AC 17 ms 3060 KB
subtask2_01.txt AC 17 ms 2940 KB
subtask2_02.txt AC 19 ms 3060 KB
subtask2_03.txt AC 19 ms 3060 KB
subtask2_04.txt AC 18 ms 3060 KB
subtask2_05.txt AC 18 ms 3060 KB
subtask2_06.txt AC 19 ms 3060 KB
subtask2_07.txt AC 21 ms 3060 KB
subtask2_08.txt AC 21 ms 3064 KB
subtask2_09.txt AC 21 ms 3060 KB
subtask2_10.txt AC 30 ms 3060 KB
subtask3_01.txt AC 165 ms 5872 KB
subtask3_02.txt AC 1137 ms 9236 KB
subtask3_03.txt AC 1138 ms 9140 KB
subtask3_04.txt TLE
subtask3_05.txt TLE
subtask3_06.txt TLE
subtask3_07.txt TLE