Submission #9606450


Source Code Expand

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

from collections import defaultdict

N = int(read())

counter = defaultdict(int)

for x in map(str,range(1,N+1)):
    head = x[0]
    tail = x[-1]
    counter[(head, tail)] += 1

answer = 0
items = list(counter.items())
for (head, tail), cnt in items:
    answer += cnt * counter[(tail, head)]

print(answer)

Submission Info

Submission Time
Task D - Handstand 2
User maspy
Language Python (3.4.3)
Score 400
Code Size 446 Byte
Status AC
Exec Time 137 ms
Memory 3572 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 5
AC × 15
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All large_01.txt, large_02.txt, large_03.txt, large_04.txt, large_05.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt, small_05.txt
Case Name Status Exec Time Memory
large_01.txt AC 137 ms 3572 KB
large_02.txt AC 137 ms 3316 KB
large_03.txt AC 134 ms 3316 KB
large_04.txt AC 136 ms 3316 KB
large_05.txt AC 133 ms 3316 KB
sample_01.txt AC 20 ms 3316 KB
sample_02.txt AC 21 ms 3316 KB
sample_03.txt AC 20 ms 3316 KB
sample_04.txt AC 21 ms 3316 KB
sample_05.txt AC 134 ms 3316 KB
small_01.txt AC 22 ms 3316 KB
small_02.txt AC 22 ms 3316 KB
small_03.txt AC 22 ms 3316 KB
small_04.txt AC 22 ms 3316 KB
small_05.txt AC 22 ms 3316 KB