Task: | Fraktaali |
Sender: | yhyy |
Submission time: | 2017-10-06 18:49:32 +0300 |
Language: | Assembly |
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.06 s | 1 | details |
#2 | ACCEPTED | 0.06 s | 2 | details |
#3 | ACCEPTED | 0.05 s | 3 | details |
#4 | ACCEPTED | 0.04 s | 4 | details |
#5 | ACCEPTED | 0.05 s | 5 | details |
#6 | ACCEPTED | 0.06 s | 6 | details |
#7 | ACCEPTED | 0.06 s | 7 | details |
#8 | ACCEPTED | 0.04 s | 8 | details |
#9 | ACCEPTED | 0.05 s | 9 | details |
#10 | ACCEPTED | 0.05 s | 10 | details |
Code
section .data section .bss syote resb 30000000 ; syöte buf resb 90090000 ; tuloste asd resb 1 section .text global _start _start: mov eax, 3 mov ebx, 0 mov ecx, syote mov edx, 30000000 int 0x80 ; lue syöte mov rsi, syote mov rdi, buf call read mov rcx, rax ; n dec rcx mov al, '#' mov r8, 1 mov r9, 1025 stosb cmp rcx, 0 je ._2 ._0: mov rsi, buf mov rdi, buf add rdi, r8 mov rdx, buf add rdx, r8 mov rbx, buf add rbx, r9 .__0: lodsb stosb cmp rsi, rdx jl .__0 sub rsi, r8 sub rdi, r8 add rsi, 1025 add rdi, 1025 add rdx, 1025 cmp rsi, rbx jl .__0 mov rsi, buf mov rdi, buf add rdi, r9 mov rdx, buf add rdx, r8 mov rbx, buf add rbx, r9 .__1: lodsb stosb cmp rsi, rdx jl .__1 sub rsi, r8 sub rdi, r8 add rsi, 1025 add rdi, 1025 add rdx, 1025 cmp rsi, rbx jl .__1 mov rsi, buf mov rdi, buf add rdi, r8 add rdi, r9 mov rdx, buf add rdx, r8 mov rbx, buf add rbx, r9 .__2: lodsb cmp al, '.' je .___0 mov al, '.' jmp .___1 .___0: mov al, '#' .___1: stosb cmp rsi, rdx jl .__2 sub rsi, r8 sub rdi, r8 add rsi, 1025 add rdi, 1025 add rdx, 1025 cmp rsi, rbx jl .__2 ._1: sal r8, 1 sal r9, 1 dec rcx cmp rcx, 0 jg ._0 ._2: mov rdi, buf mov rsi, buf mov rbx, buf add rbx, r9 ._3: lodsb cmp eax, 0 je ._4 stosb jmp ._3 ._4: dec rsi mov al, 10 stosb sub rsi, r8 add rsi, 1025 cmp rsi, rbx jl ._3 .lopeta: call flush mov rax, 1 mov rbx, 0 int 0x80 ;) ****************** flush ********************* (; ; suoritetaan lopussa niin buf tulostuu flush: ;! huom sotkee lähes KAIKEN mov rdx, rdi sub rdx, buf mov rax, 4 mov rbx, 1 mov rcx, buf int 0x80 ret ;) ****************** read ********************* (; ;! rsi nykyinen kohta syötteessä ;) laittaa syötteestä yhden luvun rax <- x, rdx <- |x|, rbx <- sign(x) ;! 64-bit ;( sotkee rbx, rdx ja rax) read: mov rbx, 1 xor rdx, rdx xor rax, rax ._: lodsb cmp al, 0x2d je ._1 cmp al, 0x30 jl ._2 cmp al, 0x39 jg ._2 sub al, 0x30 imul rdx, 10 add rdx, rax cmp rdx, 0 jne ._ jmp ._3 ._1: mov rbx, -1 ._2: cmp rdx, 0 je ._ ._3: mov rax, rdx imul rax, rbx ret ;) ***************** debug_print ******************** (; ;) säilyttää rekisterit ;( aika häviö että 0x80 nollaa r8-r11 =/ ) debug_print: push r8 push r9 push r10 push r11 push rdi push rdx push rbx push rax push rcx call print call flush pop rcx pop rax pop rbx pop rdx pop rdi pop r11 pop r10 pop r9 pop r8 ret ;) ****************** print ********************* (; ;! rdi tärkeä ;( sotkee rax, rdx, rbx) print: cmp rax, 0 jnl ._ mov rdx, rax mov al, 0x2d ;- stosb mov rax, rdx imul rax, -1 ._: mov rbx, 0xa push rdi mov rdi, asd std ._1: xor rdx, rdx div rbx xchg rax, rdx add al, 0x30 stosb xchg rax, rdx cmp rax, 0 jne ._1 cld mov rdx, rsi mov rsi, rdi inc rsi pop rdi ._2: lodsb stosb cmp rsi, asd jng ._2 mov al, 0x20 stosb mov rsi, rdx ret
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 |
---|
##############################... |