Task: | Insert Whitespace |
Sender: | bits pls |
Submission time: | 2019-05-25 15:18:37 +0300 |
Language: | Python3 |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.05 s | details |
#2 | RUNTIME ERROR | 0.06 s | details |
#3 | RUNTIME ERROR | 0.05 s | details |
#4 | RUNTIME ERROR | 0.06 s | details |
#5 | RUNTIME ERROR | 0.06 s | details |
#6 | RUNTIME ERROR | 0.06 s | details |
#7 | RUNTIME ERROR | 0.06 s | details |
#8 | RUNTIME ERROR | 0.06 s | details |
#9 | RUNTIME ERROR | 0.06 s | details |
#10 | RUNTIME ERROR | 0.05 s | details |
#11 | RUNTIME ERROR | 0.06 s | details |
#12 | RUNTIME ERROR | 0.05 s | details |
#13 | RUNTIME ERROR | 0.06 s | details |
Code
from copy import deepcopy #n,h,W,p = 2,6,33,5 n,h,w,p = map(int, input().split()) s = """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.""".split("\n") def maplines(l, li=0, o=[], s=0): if len(l) == li: return [o] out = [] for k in l[li].keys(): lenv = s + k if lenv < h and h - lenv >= 2 or lenv == h: o1 = deepcopy(o) o1.append(k) for a in maplines(l, li+1, o1, lenv): out.append(a) elif lenv > h and lenv%h >= 2: lenv = lenv - lenv//h * h o1 = deepcopy(o) o1.append(k) for a in maplines(l, li+1, o1, lenv): out.append(a) return out def addsp(w, wi=0, l=None, s=p): #if l == None: l = [p] if wi == len(w): return [l] l.append(w[wi]) s += w[wi] wi += 1 if s == W or wi == len(w): l.append(0) return addsp(w, wi, l, s=0) elif s > W: return [] l2 = deepcopy(l) s2 = s l.append(1) s += 1 if s == W: l.append(0) return addsp(w, wi, l, s=0) l2.append(2) s2 += 2 lo = [] for add in addsp(w, wi, l, s): lo.append(add) if s2 == W: l2.append(0) for add in addsp(w, wi, l2, s2): lo.append(add) return lo def getout(l): global dl o = [] a = "" for i in range(len(dl)): o.append(dl[i][l[i]]) # print(o) linecount = 0 for i in range(len(o)): a += o[i].pop(0)*" " isword = True wordi = 0 for el in o[i]: if el == 0: a += "\n" isword = True linecount += 1 if linecount == h: linecount = 0 a += "#\n" continue if isword: a += prgs[i][wordi] wordi += 1 else: a += el * " " isword = not isword return a prgs = [] dl = [] for _ in range(n): prg = input().split() # prg = s.pop(0).split() prgs.append(prg) # print("\n\n") # print(prg) pgrl = list(map(len, prg)) # print(pgrl) pos = addsp(pgrl, l=[p]) # print(pos) # print(p) # input() # if pos == []: # print("IMPOSSIBLE") d = {} for P in pos: if len(P) not in d: d[len(P)] = P dl.append(d) ans = maplines(dl) if ans == []: print("IMPOSSIBLE") else: print(getout(ans[0]), end="") #print(ans)
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
3 5 10 2 a a a a a a a a a a a a a a a ... |
correct output |
---|
a a a a a a a a a a a a a a a a a a a a ... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 2
Verdict: RUNTIME ERROR
input |
---|
3 6 10 2 a a a a a a a a a a a a a a a ... |
correct output |
---|
IMPOSSIBLE |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 3
Verdict: RUNTIME ERROR
input |
---|
3 7 10 2 a a a a a a a a a a a a a a a ... |
correct output |
---|
IMPOSSIBLE |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 4
Verdict: RUNTIME ERROR
input |
---|
3 8 10 2 a a a a a a a a a a a a a a a ... |
correct output |
---|
a a a a a a a a a a a a a a a a a a a a ... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 5
Verdict: RUNTIME ERROR
input |
---|
5 10 80 4 Lorem ipsum dolor sit amet, co... |
correct output |
---|
Lorem ipsum dolor sit amet... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 6
Verdict: RUNTIME ERROR
input |
---|
5 10 70 4 Lorem ipsum dolor sit amet, co... |
correct output |
---|
Lorem ipsum dolor sit amet... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 7
Verdict: RUNTIME ERROR
input |
---|
5 10 60 4 Lorem ipsum dolor sit amet, co... |
correct output |
---|
IMPOSSIBLE |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 8
Verdict: RUNTIME ERROR
input |
---|
55 20 80 4 Lorem ipsum dolor sit amet, co... |
correct output |
---|
Lorem ipsum dolor sit ame... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 9
Verdict: RUNTIME ERROR
input |
---|
55 20 80 6 Lorem ipsum dolor sit amet, co... |
correct output |
---|
Lorem ipsum dolor sit... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 10
Verdict: RUNTIME ERROR
input |
---|
55 20 80 8 Lorem ipsum dolor sit amet, co... |
correct output |
---|
IMPOSSIBLE |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 11
Verdict: RUNTIME ERROR
input |
---|
3 43 37 34 aaa aaaaa aaaa a aa aa aa aaa ... |
correct output |
---|
... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 12
Verdict: RUNTIME ERROR
input |
---|
4 50 73 12 aaaaa aa a aaa a aaa aaaa aaaa... |
correct output |
---|
aaaaa aa a aaa ... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...
Test 13
Verdict: RUNTIME ERROR
input |
---|
4 6 62 31 aa aaa aaa aa aaaaa aaa aaaaa ... |
correct output |
---|
... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 104, in <module> pos =...