Submission #9394047


Source Code Expand

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

import itertools

N = int(readline())
P = tuple(map(int,readline().split()))
Q = tuple(map(int,readline().split()))

permutations = list(itertools.permutations(range(1,N+1)))
p = permutations.index(P)
q = permutations.index(Q)

answer = abs(p - q)
print(answer)

Submission Info

Submission Time
Task C - Count Order
User maspy
Language Python (3.4.3)
Score 300
Code Size 394 Byte
Status AC
Exec Time 27 ms
Memory 8052 KB

Judge Result

Set Name All Sample
Score / Max Score 300 / 300 0 / 0
Status
AC × 13
AC × 3
Set Name Test Cases
All sample_01.txt, sample_02.txt, sample_03.txt, testcase_0.txt, testcase_1.txt, testcase_2.txt, testcase_3.txt, testcase_4.txt, testcase_5.txt, testcase_6.txt, testcase_7.txt, testcase_8.txt, testcase_9.txt
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 17 ms 3060 KB
sample_02.txt AC 26 ms 8052 KB
sample_03.txt AC 17 ms 3064 KB
testcase_0.txt AC 19 ms 3572 KB
testcase_1.txt AC 17 ms 3064 KB
testcase_2.txt AC 17 ms 3060 KB
testcase_3.txt AC 26 ms 8052 KB
testcase_4.txt AC 17 ms 3064 KB
testcase_5.txt AC 17 ms 3060 KB
testcase_6.txt AC 17 ms 3060 KB
testcase_7.txt AC 26 ms 8052 KB
testcase_8.txt AC 26 ms 8052 KB
testcase_9.txt AC 27 ms 8052 KB