CSES - Datatähti 2018 alku - Results
Submission details
Task:Fraktaali
Sender:yhyy
Submission time:2017-10-15 23:40:24 +0300
Language:Assembly
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED10
#2ACCEPTED10
#3ACCEPTED10
#4ACCEPTED10
#5ACCEPTED10
#6ACCEPTED10
#7ACCEPTED10
#8ACCEPTED10
#9ACCEPTED10
#10ACCEPTED10
Test results
testverdicttimegroup
#1ACCEPTED0.07 s1details
#2ACCEPTED0.07 s2details
#3ACCEPTED0.08 s3details
#4ACCEPTED0.05 s4details
#5ACCEPTED0.06 s5details
#6ACCEPTED0.07 s6details
#7ACCEPTED0.06 s7details
#8ACCEPTED0.07 s8details
#9ACCEPTED0.06 s9details
#10ACCEPTED0.05 s10details

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
	

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
##############################...