| Task: | Taulukot |
| Sender: | |
| Submission time: | 2015-10-11 15:18:15 +0300 |
| Language: | Python3 |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| #2 | RUNTIME ERROR | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.08 s | 1 | details |
| #2 | RUNTIME ERROR | 0.08 s | 1 | details |
| #3 | RUNTIME ERROR | 0.08 s | 1 | details |
| #4 | WRONG ANSWER | 0.07 s | 1 | details |
| #5 | ACCEPTED | 0.08 s | 1 | details |
| #6 | RUNTIME ERROR | 0.08 s | 2 | details |
| #7 | RUNTIME ERROR | 0.08 s | 2 | details |
| #8 | RUNTIME ERROR | 0.08 s | 2 | details |
| #9 | RUNTIME ERROR | 0.09 s | 2 | details |
| #10 | RUNTIME ERROR | 0.09 s | 2 | details |
| #11 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #12 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
n = int(input())
def eras(n):
e = [False, False] + ([True] * (n - 1))
for i in range(2, n + 1):
if e[i]:
for j in range(2 * i, n + 1, i):
e[j] = False
return e
seula = eras(2 * n)
tarjolla = set(range(1, n + 1))
toka = []
# x = 1, 2, 3 eli ekan taulukon jarjestys
# toka = [6, 3, ...] eli tokan taulukon järjestys
for x in range(1, n + 1):
for t in tarjolla:
summa = x + t
if seula[summa]:
toka.append(t)
tarjolla.remove(t)
break
else:
# vaihdetaan sopivan kanssa toka-taulukosta
# aiemman pitaa sopia tahan ja tarjolla'sta pitaa loytya sopiva aiempaan
for i in range(x - 1):
if not seula[toka[i] + x]:
continue
for t in tarjolla:
if seula[i + 1 + t]:
toka.append(toka[i])
toka[i] = t
trajolla.remove(t)
break
else:
continue
break
print(' '.join(str(x) for x in range(1, n + 1)))
print(' '.join(str(x) for x in toka))
Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 1 |
| correct output |
|---|
| 1 1 |
| user output |
|---|
| 1 1 |
Test 2
Group: 1
Verdict: RUNTIME ERROR
| input |
|---|
| 4 |
| correct output |
|---|
| 1 2 3 4 2 1 4 3 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 3
Group: 1
Verdict: RUNTIME ERROR
| input |
|---|
| 5 |
| correct output |
|---|
| 1 2 3 4 5 1 5 4 3 2 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 4
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 8 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 2 1 4 3 8 7 6 5 |
| user output |
|---|
| 1 2 3 4 5 6 7 8 1 3 2 7 6 5 4 |
Test 5
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 9 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 1 5 4 3 2 7 6 9 8 |
| user output |
|---|
| 1 2 3 4 5 6 7 8 9 1 3 2 7 6 5 4 9 8 |
Test 6
Group: 2
Verdict: RUNTIME ERROR
| input |
|---|
| 77 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 7
Group: 2
Verdict: RUNTIME ERROR
| input |
|---|
| 70 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 8
Group: 2
Verdict: RUNTIME ERROR
| input |
|---|
| 72 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 9
Group: 2
Verdict: RUNTIME ERROR
| input |
|---|
| 86 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 10
Group: 2
Verdict: RUNTIME ERROR
| input |
|---|
| 68 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 33, in <module>
trajolla.remove(t)
NameError: name 'trajolla' is not definedTest 11
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 90764 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 97976 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 13
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 96762 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 14
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 94823 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 15
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 91479 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
