AtCoder Grand Contest 023

Submission #2436869

Source codeソースコード

# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    from itertools import accumulate
    from collections import Counter

    n = int(input())
    a = [0] + list(map(int, input().split()))

    # See:
    # https://www.youtube.com/watch?v=8BHBFMrZ8VM
    # https://beta.atcoder.jp/contests/agc023/submissions/2431021
    s = list(accumulate(a))

    print(sum([si * (si - 1) // 2 for si in Counter(s).values()]))

Submission

Task問題 A - Zero-Sum Ranges
User nameユーザ名 hiro_hiro
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 200
Source lengthソースコード長 474 Byte
File nameファイル名
Exec time実行時間 139 ms
Memory usageメモリ使用量 41620 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 200 / 200 sample_01.txt,sample_02.txt,sample_03.txt,sample_01.txt,sample_02.txt,sample_03.txt,subtask_1_01.txt,subtask_1_02.txt,subtask_1_03.txt,subtask_1_04.txt,subtask_1_05.txt,subtask_1_06.txt,subtask_1_07.txt,subtask_1_08.txt,subtask_1_09.txt,subtask_1_10.txt,subtask_1_11.txt,subtask_1_12.txt,subtask_1_13.txt,subtask_1_14.txt,subtask_1_15.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 20 ms 3316 KB
sample_02.txt AC 21 ms 3316 KB
sample_03.txt AC 21 ms 3316 KB
subtask_1_01.txt AC 21 ms 3316 KB
subtask_1_02.txt AC 21 ms 3316 KB
subtask_1_03.txt AC 67 ms 16932 KB
subtask_1_04.txt AC 34 ms 6820 KB
subtask_1_05.txt AC 54 ms 11920 KB
subtask_1_06.txt AC 139 ms 41620 KB
subtask_1_07.txt AC 86 ms 14528 KB
subtask_1_08.txt AC 83 ms 12644 KB
subtask_1_09.txt AC 67 ms 6744 KB
subtask_1_10.txt AC 125 ms 32508 KB
subtask_1_11.txt AC 97 ms 23148 KB
subtask_1_12.txt AC 98 ms 24720 KB
subtask_1_13.txt AC 122 ms 32508 KB
subtask_1_14.txt AC 97 ms 24720 KB
subtask_1_15.txt AC 97 ms 23036 KB