| Task: | Fraktaali |
| Sender: | Hege |
| Submission time: | 2017-10-11 17:13:24 +0300 |
| Language: | Python3 |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 10 |
| #2 | ACCEPTED | 10 |
| #3 | ACCEPTED | 10 |
| #4 | ACCEPTED | 10 |
| #5 | ACCEPTED | 10 |
| #6 | ACCEPTED | 10 |
| #7 | ACCEPTED | 10 |
| #8 | ACCEPTED | 10 |
| #9 | ACCEPTED | 10 |
| #10 | ACCEPTED | 10 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.08 s | 1 | details |
| #2 | ACCEPTED | 0.08 s | 2 | details |
| #3 | ACCEPTED | 0.08 s | 3 | details |
| #4 | ACCEPTED | 0.07 s | 4 | details |
| #5 | ACCEPTED | 0.08 s | 5 | details |
| #6 | ACCEPTED | 0.07 s | 6 | details |
| #7 | ACCEPTED | 0.05 s | 7 | details |
| #8 | ACCEPTED | 0.08 s | 8 | details |
| #9 | ACCEPTED | 0.07 s | 9 | details |
| #10 | ACCEPTED | 0.10 s | 10 | details |
Code
### FRAKTAALI (dt2k18) ###
# this time lets obey the namespaces a bit :D quz lol
# we'll use this f() function to do a round
def f(a):
# take the current f stage
l = a[0].bit_length()
# make new hash
b = {}
# lets make the inverted thing
inv = [i ^ 2**l-1 for i in a.values()]
# then start filling the hash
# .items() means to have also index in hand
# lol pyton php'd do this with only a overloaded syntax
# pyton y u hate chewing gum
for i, row in a.items():
b[i] = row
b[i] <<= l
b[i] += row
# second stage in filling
for i, row in a.items():
b[i+l] = row
b[i+l] <<= l
b[i+l] += inv[i]
return b
def main(n):
# let's start this with n=1
a = {0: 1}
# do teh rounds
for i in range(1, n):
# lol this looks so simpel
a = f(a)
# output the result
# use our very h4x lang puke
for i in [bin(i)[2:] for i in a.values()]:
# ord("0") == 48 and ord("1") == 49
print(i.translate({48: ".", 49: "#"}))
# with this line u could see what ints it has
# but no, its not in the spec >:3
# print(repr(list(a.values())))
# somehow pyytton likes this thing as module aware lang
if __name__ == "__main__":
main(int(input()))Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 1 |
| correct output |
|---|
| # |
| user output |
|---|
| # |
Test 2
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 2 |
| correct output |
|---|
| ## #. |
| user output |
|---|
| ## #. |
Test 3
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| #### #.#. ##.. #..# |
| user output |
|---|
| #### #.#. ##.. #..# |
Test 4
Group: 4
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| ######## #.#.#.#. ##..##.. #..##..# ####.... ... |
| user output |
|---|
| ######## #.#.#.#. ##..##.. #..##..# ####.... ... |
Test 5
Group: 5
Verdict: ACCEPTED
| input |
|---|
| 5 |
| correct output |
|---|
| ################ #.#.#.#.#.#.#.#. ##..##..##..##.. #..##..##..##..# ####....####.... ... |
| user output |
|---|
| ################ #.#.#.#.#.#.#.#. ##..##..##..##.. #..##..##..##..# ####....####.... ... |
Test 6
Group: 6
Verdict: ACCEPTED
| input |
|---|
| 6 |
| correct output |
|---|
| ##############################... |
| user output |
|---|
| ##############################... |
Test 7
Group: 7
Verdict: ACCEPTED
| input |
|---|
| 7 |
| correct output |
|---|
| ##############################... |
| user output |
|---|
| ##############################... |
Test 8
Group: 8
Verdict: ACCEPTED
| input |
|---|
| 8 |
| correct output |
|---|
| ##############################... |
| user output |
|---|
| ##############################... |
Test 9
Group: 9
Verdict: ACCEPTED
| input |
|---|
| 9 |
| correct output |
|---|
| ##############################... |
| user output |
|---|
| ##############################... |
Test 10
Group: 10
Verdict: ACCEPTED
| input |
|---|
| 10 |
| correct output |
|---|
| ##############################... |
| user output |
|---|
| ##############################... |
