Submission #1000840


Source Code Expand

import itertools
n=int(input())
a=[int(input()) for i in range(n)]
b=[int(input()) for i in range(n)]
length=[]
for per in itertools.permutations(range(n)):
    s=0
    for idx_a,idx_b in enumerate(per):
        s+=abs(a[idx_a]-b[idx_b])
    length.append(s)
length.sort()
print(length.count(length[0]))

Submission Info

Submission Time
Task A - 1D Matching
User Gale
Language Python (3.4.3)
Score 0
Code Size 314 Byte
Status TLE
Exec Time 2103 ms
Memory 18340 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 2
TLE × 12
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt TLE 2103 ms 12280 KB
001.txt TLE 2103 ms 6492 KB
002.txt TLE 2103 ms 7724 KB
003.txt TLE 2102 ms 8476 KB
004.txt TLE 2103 ms 16572 KB
005.txt TLE 2103 ms 18212 KB
006.txt TLE 2103 ms 18340 KB
007.txt TLE 2103 ms 18212 KB
008.txt TLE 2103 ms 18212 KB
009.txt TLE 2103 ms 18208 KB
010.txt TLE 2103 ms 18220 KB
011.txt TLE 2103 ms 18208 KB
example0.txt AC 23 ms 3064 KB
example1.txt AC 23 ms 3064 KB