Task: | Vaihdot |
Sender: | inkeri |
Submission time: | 2018-01-18 15:35:09 +0200 |
Language: | Python3 |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.08 s | 1 | details |
#2 | WRONG ANSWER | 0.07 s | 1 | details |
#3 | WRONG ANSWER | 0.06 s | 1 | details |
#4 | WRONG ANSWER | 0.07 s | 1 | details |
#5 | ACCEPTED | 0.07 s | 1 | details |
#6 | WRONG ANSWER | 0.07 s | 2 | details |
#7 | WRONG ANSWER | 0.08 s | 2 | details |
#8 | WRONG ANSWER | 0.06 s | 2 | details |
#9 | WRONG ANSWER | 0.06 s | 2 | details |
#10 | ACCEPTED | 0.08 s | 2 | details |
#11 | WRONG ANSWER | 0.68 s | 3 | details |
#12 | WRONG ANSWER | 0.55 s | 3 | details |
#13 | WRONG ANSWER | 0.53 s | 3 | details |
#14 | WRONG ANSWER | 0.55 s | 3 | details |
#15 | ACCEPTED | 0.33 s | 3 | details |
Code
def main(): pituus = int(input()) taulukko1 = [] taulukko2 = [] for i in range(pituus): taulukko1.append([int(x) for x in input().split()]) for i in range(pituus): taulukko2.append([int(x) for x in input().split()]) sortedRivit1 = [sorted(rivi) for rivi in taulukko1] sortedRivit2 = [sorted(rivi) for rivi in taulukko2] if sorted(sortedRivit1) != sorted(sortedRivit2): print(-1) return sortedSarakkeet1 = [sorted([taulukko1[y][x] for y in range(pituus)]) for x in range(pituus)] sortedSarakkeet2 = [sorted([taulukko2[y][x] for y in range(pituus)]) for x in range(pituus)] if sorted(sortedSarakkeet1) != sorted(sortedSarakkeet2): print(-1) return rivijarjestys = [sortedRivit1.index(rivi) for rivi in sortedRivit2] sarakejarjestys = [sortedSarakkeet1.index(sarake) for sarake in sortedSarakkeet2] tuloste = [] for i in range(pituus): y = rivijarjestys.index(i) x = sarakejarjestys.index(i) if y != i: tuloste.append("1 " + str(y + 1) + " " + str(i + 1) + "\n") rivijarjestys[y], rivijarjestys[i] = rivijarjestys[i], rivijarjestys[y] if x != i: tuloste.append("2 " + str(x + 1) + " " + str(i + 1) + "\n") sarakejarjestys[x], sarakejarjestys[i] = sarakejarjestys[i], sarakejarjestys[x] print("".join(tuloste)) main()
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 2 1 7 4 3 6 8 9 5 1 7 2 ... |
correct output |
---|
2 2 1 3 2 1 2 |
user output |
---|
2 3 1 2 3 2 |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 3 7 2 1 5 6 4 8 9 7 3 2 ... |
correct output |
---|
2 1 2 3 2 1 2 |
user output |
---|
2 2 1 1 3 2 |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 3 7 8 4 5 1 6 9 2 3 8 7 ... |
correct output |
---|
1 2 2 3 |
user output |
---|
2 3 2 |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 3 1 8 5 2 6 9 4 7 3 1 8 ... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 5
Group: 1
Verdict: ACCEPTED
input |
---|
3 6 5 8 1 2 4 3 7 9 7 9 3 ... |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
50 2080 2133 335 2071 1666 1889 4... |
correct output |
---|
89 1 1 27 1 1 47 1 1 32 1 1 2 ... |
user output |
---|
1 27 1 2 9 1 1 33 2 2 23 2 1 35 3 ... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
50 59 2140 2044 1095 520 1562 153... |
correct output |
---|
88 1 1 29 1 1 47 1 1 3 1 1 26 ... |
user output |
---|
1 29 1 2 2 1 1 19 2 2 21 2 1 26 3 ... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
50 1015 2205 747 1628 2184 61 189... |
correct output |
---|
94 1 1 17 1 1 30 1 1 15 1 1 3 ... |
user output |
---|
1 17 1 2 24 1 1 38 2 2 19 2 1 7 3 ... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
50 1936 637 1930 1825 1375 688 23... |
correct output |
---|
88 1 1 45 1 1 34 1 1 26 1 1 21 ... |
user output |
---|
1 45 1 2 12 1 1 38 2 2 23 2 1 19 3 ... |
Test 10
Group: 2
Verdict: ACCEPTED
input |
---|
50 367 944 222 1047 2163 113 1076... |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 125877 110081 73003 167540 184... |
correct output |
---|
986 1 1 222 1 1 325 1 1 203 1 1 73 ... |
user output |
---|
1 222 1 2 157 1 1 60 2 2 245 2 1 38 3 ... |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 98396 218927 201855 126130 103... |
correct output |
---|
983 1 1 80 1 1 125 1 1 242 1 1 85 ... |
user output |
---|
1 80 1 2 438 1 1 244 2 2 74 2 1 371 3 ... |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 54508 62242 106667 218403 5323... |
correct output |
---|
985 1 1 356 1 1 88 1 1 142 1 1 321 ... |
user output |
---|
1 356 1 2 435 1 1 436 2 2 53 2 1 102 3 ... |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 108478 62895 206775 78592 2247... |
correct output |
---|
986 1 1 182 1 1 253 1 1 365 1 1 413 ... |
user output |
---|
1 182 1 2 126 1 1 390 2 2 335 2 1 454 3 ... |
Test 15
Group: 3
Verdict: ACCEPTED
input |
---|
500 96354 155542 19613 222634 1530... |
correct output |
---|
-1 |
user output |
---|
-1 |