Task: | Lista |
Sender: | intoo |
Submission time: | 2022-01-22 16:09:28 +0200 |
Language: | Python3 (PyPy3) |
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.04 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.14 s | 2, 3 | details |
#3 | WRONG ANSWER | 0.14 s | 3 | details |
#4 | ACCEPTED | 0.04 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.04 s | 1, 2, 3 | details |
#6 | ACCEPTED | 0.04 s | 1, 2, 3 | details |
#7 | ACCEPTED | 0.04 s | 1, 2, 3 | details |
#8 | ACCEPTED | 0.10 s | 3 | details |
#9 | WRONG ANSWER | 0.13 s | 3 | details |
#10 | ACCEPTED | 0.14 s | 3 | details |
Code
def fill_blanks(s, l): n = len(s) qs = 0 for i in range(n): qs += s[i] == '?' if qs == 0: return s if l == "": if s[0] == '?': s[0] = '1' for i in range(1, n): if s[i] == '?': s[i] = '0' return s if len(l) > len(s): return "" if len(l) < len(s): if s[0] == '?': s[0] = '1' for i in range(1, n): if s[i] == '?': s[i] = '0' if int(''.join(s)) <= int(''.join(l)): return "" return s nines = 0 for c in l: nines += c == '9' if nines == n: return "" if nines == n-1 and l[0] != '9': if s[0] == '?': s[0] = str(int(l[0]) + 1) elif s[0] <= l[0]: return "" b = [] for i in range(n): if s[i] == l[i] or s[i] == '?': b.append(0) else: b.append((int(s[i])-int(l[i]))/abs(int(s[i])-int(l[i]))) qi = [] for i in range(n): if s[i] == '?': qi.append(i) le = 0 gr = 0 while le < n and b[le] != -1: le += 1 while gr < n and b[gr] != 1: gr += 1 if gr < le: for i in qi: if i < gr: s[i] = l[i] else: s[i] = '0' elif le < gr: ti = -1 for i in qi: if i < le and l[i] != '9': ti = i if ti == -1: return "" for i in qi: if i < ti: s[i] = l[i] elif i == ti: s[i] = str(int(l[i])+1) else: s[i] = '0' else: s = str(int(''.join(l))+1) if int(''.join(s)) <= int(''.join(l)): return "" return s n = int(input()) v = [] l = "" for i in range(n): s = list(input()) s = fill_blanks(s, l) if s == "": print("IMPOSSIBLE") exit(0) v.append(''.join(s)) l = s last = -1 for s in v: if int(s) <= last: print("IMPOSSIBLE") exit(0) last = int(s) print(*v, sep="\n")
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
100 ?? ?? ?? ?? ... |
correct output |
---|
10 11 12 13 20 ... |
user output |
---|
10 11 12 13 20 ... Truncated |
Test 2
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
1000 8?? ??8? ???? ???? ... |
correct output |
---|
800 1080 1081 1082 1083 ... |
user output |
---|
800 1080 1081 1082 1083 ... Truncated |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000 ?????? ?????9? ??98??? ?????5? ... |
correct output |
---|
100000 1000090 1098000 1098050 4100001 ... |
user output |
---|
100000 1000090 1098000 1098050 4100001 ... Truncated |
Test 4
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 ? ? ? ? ... |
correct output |
---|
1 2 3 4 5 ... |
user output |
---|
1 2 3 4 5 ... Truncated |
Test 5
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
2 ??? ?? |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 6
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
3 123 ??? 124 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 7
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
5 1?? ??? 2?? ??? ... |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 8
Group: 3
Verdict: ACCEPTED
input |
---|
1000 ????????? ????????? ????????? ????????? ... |
correct output |
---|
100000000 100000001 100000002 100000003 100000004 ... |
user output |
---|
100000000 100000001 100000002 100000003 100000004 ... Truncated |
Test 9
Group: 3
Verdict: WRONG ANSWER
input |
---|
900 ???000000 ???000000 ???000000 ???000000 ... |
correct output |
---|
100000000 101000000 102000000 103000000 104000000 ... |
user output |
---|
100000000 100000001 101000000 101000001 102000000 ... Truncated |
Test 10
Group: 3
Verdict: ACCEPTED
input |
---|
1000 ???1????? ???0????? ???1????? ???0????? ... |
correct output |
---|
100100000 101000000 101100000 102000000 102100000 ... |
user output |
---|
100100000 101000000 101100000 102000000 102100000 ... Truncated |