AtCoder Beginner Contest 035

Submission #674697

Source codeソースコード

i_s=gets.chomp
i_t=gets.chomp


cmd=[0,0,0,0,0]
i_s.chars{|c|
    cmd[0]+=1 if c=='U'
    cmd[1]+=1 if c=='D'
    cmd[2]+=1 if c=='L'
    cmd[3]+=1 if c=='R'
    cmd[4]+=1 if c=='?'
}

dist=(cmd[0]-cmd[1]).abs+(cmd[2]-cmd[3]).abs

if (i_t=="1")
    p dist+cmd[4]
end
if (i_t=="2")
    if dist>cmd[4]
        p dist-cmd[4]
    elsif dist==cmd[4]
        p 0
    else
        p (dist-cmd[4]).abs%2
    end
end

Submission

Task問題 B - ドローン
User nameユーザ名 舞葉
Created time投稿日時
Language言語 Ruby (2.3.3)
Status状態 AC
Score得点 101
Source lengthソースコード長 433 Byte
File nameファイル名
Exec time実行時間 101 ms
Memory usageメモリ使用量 1916 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_example_01.txt,00_example_02.txt,00_example_03.txt,00_example_04.txt
Subtask1 100 / 100 00_example_01.txt,00_example_02.txt,00_example_03.txt,10_rand_01.txt,10_rand_02.txt,10_rand_03.txt,10_rand_04.txt,20_no_question_01.txt,20_no_question_02.txt,20_no_question_03.txt,20_no_question_04.txt,30_max_01.txt,30_max_02.txt,30_max_03.txt,30_max_04.txt,40_corner_01.txt,40_corner_02.txt,40_corner_03.txt,40_corner_04.txt
All 1 / 1 00_example_01.txt,00_example_02.txt,00_example_03.txt,00_example_04.txt,10_rand_01.txt,10_rand_02.txt,10_rand_03.txt,10_rand_04.txt,20_no_question_01.txt,20_no_question_02.txt,20_no_question_03.txt,20_no_question_04.txt,30_max_01.txt,30_max_02.txt,30_max_03.txt,30_max_04.txt,40_corner_01.txt,40_corner_02.txt,40_corner_03.txt,40_corner_04.txt,50_hand_01.txt,50_hand_02.txt,50_hand_03.txt,60_rand_01.txt,60_rand_02.txt,60_rand_03.txt,60_rand_04.txt,70_no_ques_01.txt,70_no_ques_02.txt,70_no_ques_03.txt,70_no_ques_04.txt,80_max_01.txt,80_max_02.txt,80_max_03.txt,80_max_04.txt,90_corner_01.txt,90_corner_02.txt,90_corner_03.txt,90_corner_04.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_example_01.txt AC 16 ms 1788 KB
00_example_02.txt AC 17 ms 1788 KB
00_example_03.txt AC 17 ms 1788 KB
00_example_04.txt AC 17 ms 1788 KB
10_rand_01.txt AC 31 ms 1788 KB
10_rand_02.txt AC 17 ms 1788 KB
10_rand_03.txt AC 20 ms 1788 KB
10_rand_04.txt AC 22 ms 1788 KB
20_no_question_01.txt AC 33 ms 1788 KB
20_no_question_02.txt AC 18 ms 1788 KB
20_no_question_03.txt AC 21 ms 1788 KB
20_no_question_04.txt AC 22 ms 1788 KB
30_max_01.txt AC 98 ms 1916 KB
30_max_02.txt AC 98 ms 1916 KB
30_max_03.txt AC 101 ms 1916 KB
30_max_04.txt AC 98 ms 1916 KB
40_corner_01.txt AC 97 ms 1916 KB
40_corner_02.txt AC 95 ms 1916 KB
40_corner_03.txt AC 95 ms 1916 KB
40_corner_04.txt AC 98 ms 1916 KB
50_hand_01.txt AC 17 ms 1788 KB
50_hand_02.txt AC 16 ms 1788 KB
50_hand_03.txt AC 17 ms 1788 KB
60_rand_01.txt AC 31 ms 1788 KB
60_rand_02.txt AC 17 ms 1788 KB
60_rand_03.txt AC 21 ms 1788 KB
60_rand_04.txt AC 23 ms 1788 KB
70_no_ques_01.txt AC 34 ms 1788 KB
70_no_ques_02.txt AC 19 ms 1788 KB
70_no_ques_03.txt AC 22 ms 1788 KB
70_no_ques_04.txt AC 23 ms 1788 KB
80_max_01.txt AC 98 ms 1916 KB
80_max_02.txt AC 99 ms 1916 KB
80_max_03.txt AC 98 ms 1916 KB
80_max_04.txt AC 98 ms 1916 KB
90_corner_01.txt AC 94 ms 1916 KB
90_corner_02.txt AC 95 ms 1916 KB
90_corner_03.txt AC 97 ms 1916 KB
90_corner_04.txt AC 98 ms 1916 KB