Submission #12754173


Source Code Expand

Copy
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())

memo = defaultdict(int)
answer = 0
for i, x in enumerate(A, 1):
    answer += memo[i - x]
    memo[x + i] += 1

print(answer)

Submission Info

Submission Time
Task E - This Message Will Self-Destruct in 5s
User maspy
Language Python (3.8.2)
Score 500
Code Size 328 Byte
Status AC
Exec Time 230 ms
Memory 61572 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 52
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt, sub1_small_01.txt, sub1_small_02.txt, sub1_small_03.txt, sub1_small_04.txt, sub1_small_05.txt, sub1_small_06.txt, sub1_small_07.txt, sub1_small_08.txt, sub1_small_09.txt, sub1_small_10.txt, sub1_small_11.txt, sub1_small_12.txt, sub1_small_13.txt, sub1_small_14.txt, sub1_small_15.txt, sub1_small_16.txt, sub1_small_17.txt, sub1_small_18.txt, sub1_small_19.txt, sub1_small_20.txt
Case Name Status Exec Time Memory
sample_01.txt AC 21 ms 9176 KB
sample_02.txt AC 19 ms 9324 KB
sample_03.txt AC 26 ms 9328 KB
sub1_01.txt AC 119 ms 25160 KB
sub1_02.txt AC 91 ms 23752 KB
sub1_03.txt AC 197 ms 40464 KB
sub1_04.txt AC 230 ms 61572 KB
sub1_05.txt AC 62 ms 15948 KB
sub1_06.txt AC 158 ms 37516 KB
sub1_07.txt AC 55 ms 15344 KB
sub1_08.txt AC 142 ms 34368 KB
sub1_09.txt AC 99 ms 25568 KB
sub1_10.txt AC 147 ms 40760 KB
sub1_11.txt AC 103 ms 25064 KB
sub1_12.txt AC 178 ms 40396 KB
sub1_13.txt AC 55 ms 16980 KB
sub1_14.txt AC 167 ms 40756 KB
sub1_15.txt AC 36 ms 11944 KB
sub1_16.txt AC 46 ms 14028 KB
sub1_17.txt AC 194 ms 40472 KB
sub1_18.txt AC 102 ms 25592 KB
sub1_19.txt AC 136 ms 26600 KB
sub1_20.txt AC 165 ms 30352 KB
sub1_21.txt AC 55 ms 16808 KB
sub1_22.txt AC 141 ms 28472 KB
sub1_23.txt AC 164 ms 29840 KB
sub1_24.txt AC 151 ms 28828 KB
sub1_25.txt AC 162 ms 28552 KB
sub1_26.txt AC 160 ms 28448 KB
sub1_27.txt AC 76 ms 18480 KB
sub1_28.txt AC 86 ms 18064 KB
sub1_29.txt AC 162 ms 28244 KB
sub1_small_01.txt AC 19 ms 9456 KB
sub1_small_02.txt AC 19 ms 9144 KB
sub1_small_03.txt AC 22 ms 9164 KB
sub1_small_04.txt AC 24 ms 9404 KB
sub1_small_05.txt AC 20 ms 9520 KB
sub1_small_06.txt AC 23 ms 9524 KB
sub1_small_07.txt AC 20 ms 9344 KB
sub1_small_08.txt AC 21 ms 9572 KB
sub1_small_09.txt AC 22 ms 9308 KB
sub1_small_10.txt AC 20 ms 9340 KB
sub1_small_11.txt AC 22 ms 9728 KB
sub1_small_12.txt AC 19 ms 9184 KB
sub1_small_13.txt AC 21 ms 9604 KB
sub1_small_14.txt AC 21 ms 9280 KB
sub1_small_15.txt AC 20 ms 9428 KB
sub1_small_16.txt AC 23 ms 9664 KB
sub1_small_17.txt AC 25 ms 9524 KB
sub1_small_18.txt AC 23 ms 9520 KB
sub1_small_19.txt AC 22 ms 9668 KB
sub1_small_20.txt AC 20 ms 9524 KB