Submission #2572182
Source Code Expand
s = input() t = int(input()) q = 0 x, y = 0, 0 dic = {"L": (1, 0), "R": (-1, 0), "U": (0, 1),"D": (0, -1)} for i in range(len(s)): if s[i] == "?": q += 1 else: x, y = x + dic[s[i]][0], y + dic[s[i]][1] if t == 1: print(abs(x) + abs(y) + q) else: s, t = abs(x), abs(y) if s + t >= q: print(s + t - q) else: if (q - (s + t)) % 2 == 0: print(0) else: print(1)
Submission Info
Submission Time | |
---|---|
Task | B - ドローン |
User | ys5678910 |
Language | Python (3.4.3) |
Score | 101 |
Code Size | 466 Byte |
Status | AC |
Exec Time | 59 ms |
Memory | 3188 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | 1 / 1 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt |
Subtask1 | 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 | 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 17 ms | 3064 KB |
00_example_02.txt | AC | 17 ms | 3064 KB |
00_example_03.txt | AC | 17 ms | 3064 KB |
00_example_04.txt | AC | 17 ms | 3064 KB |
10_rand_01.txt | AC | 25 ms | 3064 KB |
10_rand_02.txt | AC | 17 ms | 3064 KB |
10_rand_03.txt | AC | 19 ms | 3064 KB |
10_rand_04.txt | AC | 20 ms | 3064 KB |
20_no_question_01.txt | AC | 25 ms | 3064 KB |
20_no_question_02.txt | AC | 17 ms | 3064 KB |
20_no_question_03.txt | AC | 19 ms | 3064 KB |
20_no_question_04.txt | AC | 20 ms | 3064 KB |
30_max_01.txt | AC | 57 ms | 3188 KB |
30_max_02.txt | AC | 57 ms | 3188 KB |
30_max_03.txt | AC | 58 ms | 3188 KB |
30_max_04.txt | AC | 55 ms | 3188 KB |
40_corner_01.txt | AC | 53 ms | 3188 KB |
40_corner_02.txt | AC | 33 ms | 3188 KB |
40_corner_03.txt | AC | 35 ms | 3188 KB |
40_corner_04.txt | AC | 48 ms | 3188 KB |
50_hand_01.txt | AC | 17 ms | 3064 KB |
50_hand_02.txt | AC | 17 ms | 3064 KB |
50_hand_03.txt | AC | 17 ms | 3064 KB |
60_rand_01.txt | AC | 25 ms | 3064 KB |
60_rand_02.txt | AC | 17 ms | 3064 KB |
60_rand_03.txt | AC | 19 ms | 3064 KB |
60_rand_04.txt | AC | 19 ms | 3064 KB |
70_no_ques_01.txt | AC | 25 ms | 3064 KB |
70_no_ques_02.txt | AC | 20 ms | 3064 KB |
70_no_ques_03.txt | AC | 19 ms | 3064 KB |
70_no_ques_04.txt | AC | 20 ms | 3188 KB |
80_max_01.txt | AC | 58 ms | 3188 KB |
80_max_02.txt | AC | 59 ms | 3188 KB |
80_max_03.txt | AC | 58 ms | 3188 KB |
80_max_04.txt | AC | 57 ms | 3188 KB |
90_corner_01.txt | AC | 33 ms | 3188 KB |
90_corner_02.txt | AC | 36 ms | 3188 KB |
90_corner_03.txt | AC | 48 ms | 3188 KB |
90_corner_04.txt | AC | 49 ms | 3188 KB |