結果

問題 No.5 数字のブロック
ユーザー antaanta
提出日時 2016-03-31 23:52:56
言語 Assembler
(nasm 2.16.01)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 10,572 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 5,272 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 14:52:52
合計ジャッジ時間 1,594 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 0 ms
4,376 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 0 ms
4,380 KB
testcase_14 AC 0 ms
4,380 KB
testcase_15 AC 0 ms
4,380 KB
testcase_16 AC 0 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 0 ms
4,376 KB
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 0 ms
4,376 KB
testcase_22 AC 0 ms
4,376 KB
testcase_23 AC 0 ms
4,376 KB
testcase_24 AC 0 ms
4,376 KB
testcase_25 AC 0 ms
4,380 KB
testcase_26 AC 0 ms
4,380 KB
testcase_27 AC 0 ms
4,376 KB
testcase_28 AC 0 ms
4,376 KB
testcase_29 AC 0 ms
4,380 KB
testcase_30 AC 0 ms
4,380 KB
testcase_31 AC 0 ms
4,376 KB
testcase_32 AC 0 ms
4,380 KB
testcase_33 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

default rel
global _start
section .text
_start:
        push    r12
        lea     rcx, [rel _ZL2in]
        push    rbp
        push    rdi
        push    rsi
        push    rbx
        sub     rsp, 80
        lea     rdx, [rsp+28H]
        call    _ZN9FastInput11read_signedIiEEvPT_
        lea     rdx, [rsp+2CH]
        lea     rcx, [rel _ZL2in]
        call    _ZN9FastInput11read_signedIiEEvPT_
        mov     eax, dword [rsp+2CH]
        test    eax, eax
        jle     L_031
        xor     r10d, r10d
        xor     ebp, ebp
        mov     r9, qword 100002600H
        lea     rbx, [rel _ZZL6mymainvE3cnt]
        xor     edi, edi
        mov     edx, 4096
        lea     rsi, [rel _ZL9stdin_buf]
ALIGN   8
L_001:  cmp     byte [rel _ZL2in], 0
        jne     L_010
ALIGN   8
L_002:  mov     rax, qword [rel _ZL13stdin_buf_ptr]
        cmp     rax, qword [rel _ZL13stdin_buf_end]
        je      L_021
L_003:  lea     rcx, [rax+1H]
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        movsx   eax, byte [rax]
        cmp     al, -1
        je      L_009
        cmp     al, 32
        jbe     L_008
L_004:  cmp     al, 45
        je      L_024
        lea     ecx, [rax-30H]
        cmp     cl, 9
        ja      L_010
        mov     rcx, qword [rel _ZL13stdin_buf_ptr]
        xor     r12d, r12d
L_005:  xor     r8d, r8d
        jmp     L_007
L_006:  lea     rcx, [rax+1H]
        movsx   eax, byte [rax]
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        lea     r11d, [rax-30H]
        cmp     r11b, 9
        ja      L_022
L_007:  cmp     qword [rel _ZL13stdin_buf_end], rcx
        lea     r8d, [r8+r8*4]
        lea     r8d, [rax+r8*2-30H]
        mov     rax, rcx
        jnz     L_006
        mov     eax, edi
        syscall
        lea     rcx, [rel _ZL9stdin_buf]
        add     rax, rsi
        mov     qword [rel _ZL13stdin_buf_end], rax
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        cmp     rax, rsi
        je      L_022
        mov     rax, rcx
        jmp     L_006
L_008:  bt      r9, rax
        jc      L_002
        jmp     L_004
ALIGN   8
L_009:  mov     byte [rel _ZL2in], 1
L_010:  xor     r8d, r8d
L_011:  movsxd  rax, r8d
        add     dword [rbx+rax*4], 1
        cmp     r10d, r8d
        cmovl   r10d, r8d
        add     ebp, 1
        cmp     dword [rsp+2CH], ebp
        jg      L_001
        test    r10d, r10d
        je      L_032
        mov     r9d, dword [rsp+28H]
        test    r9d, r9d
        jle     L_032
        xor     r11d, r11d
        xor     ecx, ecx
        mov     eax, 1
        jmp     L_013
ALIGN   16
L_012:  cmp     eax, r9d
        jg      L_015
L_013:  movsxd  r8, eax
        mov     edx, dword [rbx+r8*4]
        test    edx, edx
        jle     L_014
        lea     r11, [rel _ZZL6mymainvE3cnt]
        sub     edx, 1
        sub     r9d, eax
        mov     dword [r11+r8*4], edx
        add     ecx, 1
        sub     eax, 1
        mov     r11d, 1
L_014:  add     eax, 1
        cmp     eax, r10d
        jle     L_012
L_015:  test    r11b, r11b
        jne     L_033
L_016:  lea     r9, [rsp+30H]
        xor     r8d, r8d
        mov     r10d, 1717986919
ALIGN   8
L_017:  mov     eax, ecx
        add     r8d, 1
        add     r9, 1
        imul    r10d
        mov     eax, ecx
        sar     eax, 31
        sar     edx, 2
        sub     edx, eax
        lea     eax, [rdx+rdx*4]
        add     eax, eax
        sub     ecx, eax
        mov     byte [r9-1H], cl
        mov     ecx, edx
        test    edx, edx
        jnz     L_017
L_018:  lea     rsi, [rel _ZL10stdout_buf]
        mov     edi, 1
        mov     edx, 4096
        mov     r10, qword [rel _ZL14stdout_buf_ptr]
        lea     rbx, [rel _ZL9stdin_buf]
        mov     rbp, rsi
        jmp     L_020
ALIGN   8
L_019:  lea     r10, [rcx+1H]
        mov     byte [rcx], r9b
        mov     qword [rel _ZL14stdout_buf_ptr], r10
        test    r8d, r8d
        je      L_026
L_020:  sub     r8d, 1
        mov     rcx, r10
        movsxd  rax, r8d
        movzx   r9d, byte [rsp+rax+30H]
        add     r9d, 48
        cmp     r10, rbx
        jnz     L_019
        mov     eax, edi
        syscall
        lea     rsi, [rel _ZL10stdout_buf]
        mov     rcx, rsi
        jmp     L_019
L_021:  mov     eax, edi
        syscall
        lea     rcx, [rel _ZL9stdin_buf]
        add     rax, rsi
        mov     qword [rel _ZL13stdin_buf_end], rax
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        cmp     rax, rsi
        je      L_009
        mov     rax, rcx
        jmp     L_003
ALIGN   8
L_022:  test    r12b, r12b
        je      L_011
L_023:  neg     r8d
        jmp     L_011
L_024:  mov     rax, qword [rel _ZL13stdin_buf_ptr]
        cmp     rax, qword [rel _ZL13stdin_buf_end]
        jz      L_028
L_025:  lea     rcx, [rax+1H]
        movsx   eax, byte [rax]
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        lea     r8d, [rax-30H]
        cmp     r8b, 9
        ja      L_029
        mov     r12d, 1
        jmp     L_005
L_026:  cmp     r10, rbx
        jz      L_030
L_027:  lea     rdx, [r10+1H]
        mov     eax, 1
        mov     byte [r10], 10
        mov     qword [rel _ZL14stdout_buf_ptr], rdx
        mov     edi, eax
        sub     rdx, rbp
        syscall
        lea     rax, [rel _ZL10stdout_buf]
        xor     edi, edi
        mov     qword [rel _ZL14stdout_buf_ptr], rax
        mov     eax, 60
        syscall
L_028:  mov     eax, edi
        syscall
        lea     rcx, [rsi+rax]
        lea     rax, [rel _ZL9stdin_buf]
        mov     qword [rel _ZL13stdin_buf_end], rcx
        mov     qword [rel _ZL13stdin_buf_ptr], rax
        cmp     rcx, rsi
        jnz     L_025
L_029:  xor     r8d, r8d
        jmp     L_023
L_030:  mov     eax, 1
        mov     edx, 4096
        mov     edi, eax
        syscall
        lea     rsi, [rel _ZL10stdout_buf]
        mov     r10, rsi
        jmp     L_027
L_031:  xor     ecx, ecx
        jmp     L_016
L_032:  mov     byte [rsp+30H], 0
        mov     r8d, 1
        jmp     L_018
L_033:
        mov     dword [rsp+28H], r9d
        jmp     L_016
section .data
_ZL14stdout_buf_ptr:
        dq _ZL10stdout_buf
_ZL13stdin_buf_ptr:
        dq _ZL9stdin_buf
_ZL13stdin_buf_end:
        dq _ZL9stdin_buf
        dq 0000000000000000H
section .bss
_ZZL6mymainvE3cnt:
        resb    400004
_ZL2in: resb    28
_ZL10stdout_buf:
        resb    4096
_ZL9stdin_buf:
        resb    4096
section .text
_ZN9FastInput11read_signedIiEEvPT_:
        cmp     byte [rcx], 0
        mov     r9, rdx
        jne     L_051
        push    rdi
        mov     r10, rcx
        push    rsi
        mov     rsi, qword [rel _ZL13stdin_buf_ptr]
        cmp     rsi, qword [rel _ZL13stdin_buf_end]
        je      L_049
L_034:  lea     rax, [rsi+1H]
        mov     qword [rel _ZL13stdin_buf_ptr], rax
        movsx   eax, byte [rsi]
        cmp     al, -1
        je      L_042
        lea     rsi, [rel _ZL9stdin_buf]
        xor     edi, edi
        mov     edx, 4096
        mov     r8, qword 100002600H
L_035:  cmp     al, 32
        jbe     L_040
L_036:  cmp     al, 45
        je      L_046
        lea     edx, [rax-30H]
        cmp     dl, 9
        ja      L_043
        mov     rcx, qword [rel _ZL13stdin_buf_ptr]
        xor     r10d, r10d
L_037:  xor     r8d, r8d
        xor     edi, edi
        mov     edx, 4096
        lea     rsi, [rel _ZL9stdin_buf]
        jmp     L_039
ALIGN   8
L_038:  lea     rcx, [rax+1H]
        movsx   eax, byte [rax]
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        lea     r11d, [rax-30H]
        cmp     r11b, 9
        ja      L_048
L_039:  cmp     qword [rel _ZL13stdin_buf_end], rcx
        lea     r8d, [r8+r8*4]
        lea     r8d, [rax+r8*2-30H]
        mov     rax, rcx
        jnz     L_038
        mov     eax, edi
        syscall
        lea     rcx, [rel _ZL9stdin_buf]
        add     rax, rsi
        mov     qword [rel _ZL13stdin_buf_end], rax
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        cmp     rax, rsi
        je      L_048
        mov     rax, rcx
        jmp     L_038
ALIGN   8
L_040:  bt      r8, rax
        jnc     L_036
        mov     rax, qword [rel _ZL13stdin_buf_ptr]
        cmp     rax, qword [rel _ZL13stdin_buf_end]
        jz      L_045
L_041:  lea     rcx, [rax+1H]
        movsx   eax, byte [rax]
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        cmp     al, -1
        jne     L_035
L_042:  mov     byte [r10], 1
L_043:  xor     eax, eax
L_044:  pop     rsi
        mov     dword [r9], eax
        pop     rdi
        ret
ALIGN   8
L_045:  mov     eax, edi
        syscall
        lea     rcx, [rel _ZL9stdin_buf]
        add     rax, rsi
        mov     qword [rel _ZL13stdin_buf_end], rax
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        cmp     rax, rsi
        jz      L_042
        mov     rax, rcx
        jmp     L_041
ALIGN   16
L_046:  mov     rsi, qword [rel _ZL13stdin_buf_ptr]
        cmp     rsi, qword [rel _ZL13stdin_buf_end]
        jz      L_050
L_047:  movsx   eax, byte [rsi]
        lea     rcx, [rsi+1H]
        mov     qword [rel _ZL13stdin_buf_ptr], rcx
        lea     edx, [rax-30H]
        cmp     dl, 9
        ja      L_043
        mov     r10d, 1
        jmp     L_037
L_048:  mov     eax, r8d
        test    r10b, r10b
        jz      L_044
        neg     eax
        pop     rsi
        mov     dword [r9], eax
        pop     rdi
        ret
L_049:  lea     rsi, [rel _ZL9stdin_buf]
        xor     eax, eax
        mov     edx, 4096
        mov     edi, eax
        syscall
        add     rax, rsi
        mov     qword [rel _ZL13stdin_buf_ptr], rsi
        mov     qword [rel _ZL13stdin_buf_end], rax
        cmp     rax, rsi
        jne     L_034
        jmp     L_042
L_050:  lea     rsi, [rel _ZL9stdin_buf]
        xor     eax, eax
        mov     edx, 4096
        mov     edi, eax
        syscall
        add     rax, rsi
        mov     qword [rel _ZL13stdin_buf_ptr], rsi
        mov     qword [rel _ZL13stdin_buf_end], rax
        cmp     rax, rsi
        jne     L_047
        jmp     L_043
L_051:
        xor     eax, eax
        mov     dword [rdx], eax
        ret
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
section .text
.text.startup:
_GLOBAL__sub_I__start:
        mov     byte [rel _ZL2in], 0
        ret
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
section .ctors
        dq _GLOBAL__sub_I__start
section .rdata
0