Task: | Kyselyt |
Sender: | yhyy |
Submission time: | 2017-10-15 23:39:20 +0300 |
Language: | Assembly |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 12 |
#2 | ACCEPTED | 25 |
#3 | ACCEPTED | 63 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.07 s | 1 | details |
#2 | ACCEPTED | 0.06 s | 2 | details |
#3 | ACCEPTED | 0.07 s | 3 | details |
Code
section .datasection .bsssyote resb 30000000 ; syötebuf resb 90090000 ; tulosteasd resb 1section .textglobal _start_start:mov eax, 3mov ebx, 0mov ecx, syotemov edx, 30000000int 0x80 ; lue syötemov rsi, syotemov rdi, bufcall readmov r15, rax ; nxor r14, r14mov r13, buf._00:call readmov r8, 1mov r9, 9mov r10, 1._0: mov rdx, r9imul rdx, r8cmp rax, rdxjle ._1sub rax, rdximul r9, 10inc r8imul r10, 10jmp ._0._1:dec raxxor rdx, rdxcqodiv r8add rax, r10mov r12, rsimov rsi, rdiadd rsi, rdxcall printxchg rdi, r13lodsbstosbmov al, ' 'stosbxchg rdi, r13mov rsi, r12inc r14cmp r14, r15jl ._00xchg rdi, r13.lopeta:call flushmov rax, 1mov rbx, 0int 0x80;) ****************** flush ********************* (;; suoritetaan lopussa niin buf tulostuuflush: ;! huom sotkee lähes KAIKENmov rdx, rdisub rdx, bufmov rax, 4mov rbx, 1mov rcx, bufint 0x80ret;) ****************** 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, 1xor rdx, rdxxor rax, rax._: lodsbcmp al, 0x2dje ._1cmp al, 0x30jl ._2cmp al, 0x39jg ._2sub al, 0x30imul rdx, 10add rdx, raxcmp rdx, 0jne ._jmp ._3._1: mov rbx, -1._2: cmp rdx, 0je ._._3: mov rax, rdximul rax, rbxret;) ****************** print ********************* (;;! rdi tärkeä;( sotkee rax, rdx, rbx)print:cmp rax, 0jnl ._mov rdx, raxmov al, 0x2d ;-stosbmov rax, rdximul rax, -1._: mov rbx, 0xapush rdimov rdi, asdstd._1: xor rdx, rdxdiv rbxxchg rax, rdxadd al, 0x30stosbxchg rax, rdxcmp rax, 0jne ._1cldmov rdx, rsimov rsi, rdiinc rsipop rdi._2: lodsbstosbcmp rsi, asdjng ._2mov al, 0x20stosbmov rsi, rdxret
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
1000 582 214 723 273 ... |
correct output |
---|
0 1 7 7 6 ... |
user output |
---|
0 1 7 7 6 1 5 4 7 6 2 2 2 2 8 ... Truncated |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
1000 615664 916441 627600 279508 ... |
correct output |
---|
1 2 3 2 2 ... |
user output |
---|
1 2 3 2 2 8 7 9 8 3 7 1 9 8 4 ... Truncated |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
1000 672274832941907421 260504693279721732 646999966092970935 100853063389774434 ... |
correct output |
---|
7 2 2 0 9 ... |
user output |
---|
7 2 2 0 9 7 7 2 0 4 0 3 0 5 9 ... Truncated |