Task: | Ratsun reitit |
Sender: | ov |
Submission time: | 2020-10-09 22:34:52 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#2 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#3 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#4 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#5 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#6 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#7 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#8 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#9 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#10 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#11 | TIME LIMIT EXCEEDED | -- | 3 | details |
#12 | TIME LIMIT EXCEEDED | -- | 3 | details |
#13 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
import time start_time = time.time() #n = input() n = 100 n = int(n) import time siirrot = 0 done = False ratsut = [[0, 0]] ratsut2 = [] uudet_ratsut = [] vieraillut = [] lauta = {} def tarkista(): a = True for i in range(n): for j in range(n): if lauta[i][j] == "x": a = False break if a == True: return True elif a == False: return False def onkoalueella(sijainti): x = sijainti[0] y = sijainti[1] if x >= 0 and x < n and y >= 0 and y < n: return True else: return False def onkojokäyty(sijainti): x = sijainti[0] y = sijainti[1] if lauta[x][y] == "x": return False else: return True def mahd_siirrot(sijainti): x = sijainti[0] y = sijainti[1] uudet_sijainnit = [[x - 1, y + 2], [x -2, y + 1], [x + 1, y + 2], [x + 2, y + 1], [x - 2, y - 1], [x - 1, y - 2], [x + 2, y - 1], [x + 1, y - 2]] oikeat_sijainnit = uudet_sijainnit oikeat_sijainnit = [i for i in uudet_sijainnit if onkoalueella(i)] oikeat_eikäydyt_sijainnit = [j for j in oikeat_sijainnit if not onkojokäyty(j)] return oikeat_eikäydyt_sijainnit def merkitse_kaydyksi(sijainti, siirrot): x = sijainti[0] y = sijainti[1] lauta[x][y] = str(siirrot) vieraillut.append(sijainti) def tulosta(lautaArg): for p in range(n): for l in range(len(lautaArg[p])): string2 = str(lautaArg[p][l]) lautaArg[p][l] = string2 string = ' '.join([str(elem) for elem in lautaArg[p]]) print(string) for i in range(n): lauta[i] = [] for j in range(n): lauta[i].append("x") lauta[0][0] = 0 q = 0 while done == False: if q == 0: ratsut = [[0, 0]] else: ratsut = [] for u in range(len(ratsut2)): x = ratsut2[u][0] y = ratsut2[u][1] if str(lauta[x][y]) == str(siirrot): ratsut.append(ratsut2[u]) ratsut2 = [] q = 1 siirrot = siirrot + 1 for i in range(len(ratsut)): ratsu = ratsut[i] x = ratsu[0] y = ratsu[1] uudet_ratsut = mahd_siirrot(ratsu) for j in range(len(uudet_ratsut)): merkitse_kaydyksi(uudet_ratsut[j], siirrot) for j in range(len(uudet_ratsut)): ratsut2.append(uudet_ratsut[j]) if tarkista() == True: done = True break tulosta(lauta) print("My program took", time.time() - start_time, "to run.")
Test details
Test 1
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 |
correct output |
---|
0 3 2 5 3 4 1 2 2 1 4 3 5 2 3 2 |
user output |
---|
(empty) |
Test 2
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 |
correct output |
---|
0 3 2 3 2 3 4 1 2 3 2 1 4 3 2 3 2 3 2 3 2 3 2 3 4 |
user output |
---|
(empty) |
Test 3
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
6 |
correct output |
---|
0 3 2 3 2 3 3 4 1 2 3 4 2 1 4 3 2 3 3 2 3 2 3 4 2 3 2 3 4 3 ... |
user output |
---|
(empty) |
Test 4
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
7 |
correct output |
---|
0 3 2 3 2 3 4 3 4 1 2 3 4 3 2 1 4 3 2 3 4 3 2 3 2 3 4 3 2 3 2 3 4 3 4 ... |
user output |
---|
(empty) |
Test 5
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
8 |
correct output |
---|
0 3 2 3 2 3 4 5 3 4 1 2 3 4 3 4 2 1 4 3 2 3 4 5 3 2 3 2 3 4 3 4 2 3 2 3 4 3 4 5 ... |
user output |
---|
(empty) |
Test 6
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
9 |
correct output |
---|
0 3 2 3 2 3 4 5 4 3 4 1 2 3 4 3 4 5 2 1 4 3 2 3 4 5 4 3 2 3 2 3 4 3 4 5 2 3 2 3 4 3 4 5 4 ... |
user output |
---|
(empty) |
Test 7
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 3 4 1 2 3 4 3 4 5 6 2 1 4 3 2 3 4 5 4 5 3 2 3 2 3 4 3 4 5 6 2 3 2 3 4 3 4 5 4 5 ... |
user output |
---|
(empty) |
Test 8
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
25 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 9
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
49 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 10
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
50 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 11
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
75 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
99 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |
Test 13
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 |
correct output |
---|
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ... |
user output |
---|
(empty) |