Task: | Swapping letters |
Sender: | FiratKiyak |
Submission time: | 2018-09-15 15:59:14 +0300 |
Language: | Python2 |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.04 s | details |
#2 | ACCEPTED | 0.04 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | TIME LIMIT EXCEEDED | -- | details |
#8 | ACCEPTED | 0.41 s | details |
#9 | WRONG ANSWER | 0.39 s | details |
#10 | WRONG ANSWER | 0.39 s | details |
Code
# -*- coding: utf-8 -*- """ Created on Sat Sep 15 15:46:11 2018 @author: kiyakf1 """ def function(): n = int(raw_input()) pairs = [] for i in range(n): pairs.append(raw_input().split(" ")) x = list(raw_input()) y = list(raw_input()) def pairmap(string, pairs): pairmap = [] for i in range(len(pairs)): pairmap.append([0]) for x in string: for i in range(len(pairs)): if x == pairs[i][0]: if len(pairmap[i])% 2 == 0: pairmap[i].append(1) else: pairmap[i][len(pairmap[i])-1]+=1 if x == pairs[i][1]: if len(pairmap[i])% 2 == 0: pairmap[i][len(pairmap[i])-1]+=1 else: pairmap[i].append(1) return pairmap for mapx,mapy in zip(pairmap(x,pairs),pairmap(y,pairs)): if(mapx != mapy): return "NO" return "YES" print function()
Test details
Test 1
Verdict: ACCEPTED
input |
---|
5 a b b c c d d e ... |
correct output |
---|
YES |
user output |
---|
YES |
Test 2
Verdict: ACCEPTED
input |
---|
2 a b b c acbbaca cabbaac |
correct output |
---|
YES |
user output |
---|
YES |
Test 3
Verdict: ACCEPTED
input |
---|
2 a b b c acbbaca baccaab |
correct output |
---|
NO |
user output |
---|
NO |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 d c e b f y h q ... |
correct output |
---|
YES |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 a i a l d a g h ... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
325 a b a e a f a g ... |
correct output |
---|
YES |
user output |
---|
(empty) |
Test 7
Verdict: TIME LIMIT EXCEEDED
input |
---|
325 a c a e a g a h ... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 8
Verdict: ACCEPTED
input |
---|
0 dlkinfmdyjaofxbccwhhbxzartqwdr... |
correct output |
---|
YES |
user output |
---|
YES |
Test 9
Verdict: WRONG ANSWER
input |
---|
0 bxisdrdpgcsnnvhnfgimivzqpqjwqc... |
correct output |
---|
NO |
user output |
---|
YES |
Test 10
Verdict: WRONG ANSWER
input |
---|
0 mrwduerojcguvxzmbomfsainvqehsl... |
correct output |
---|
NO |
user output |
---|
YES |