Submission #924392
Source Code Expand
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.function.BiFunction; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } int[][] ofs = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} }; String list = "LRUD?"; void run() { String str = sc.next(); int u = 0; int v = 0; int x = 0; int y = 0; for (int i = 0; i < str.length(); ++i) { char c = str.charAt(i); int idx = list.indexOf(c); if (idx < 4) { x += ofs[idx][0]; y += ofs[idx][1]; } else { ++u; --v; } } int T = ni(); int h = Math.abs(x) + Math.abs(y); if (T == 1) { System.out.println(h + u); } else { System.out.println(h + v); } } int ni() { return Integer.parseInt(sc.next()); } void debug(Object... os) { System.err.println(Arrays.deepToString(os)); } class BIT<T> { int n; ArrayList<T> bit; BiFunction<T, T, T> bif; BIT(int n, BiFunction<T, T, T> bif, T defaultValue) { this.n = n; bit = new ArrayList<>(n + 1); for (int i = 0; i < n + 1; ++i) { bit.add(defaultValue); } this.bif = bif; } void update(int i, T v) { for (int x = i; x <= n; x += x & -x) { bit.set(x, bif.apply(bit.get(x), v)); } } T reduce(int i, T defaultValue) { T ret = defaultValue; for (int x = i; x > 0; x -= x & -x) { ret = bif.apply(ret, bit.get(x)); } return ret; } } }
Submission Info
Submission Time | |
---|---|
Task | B - ドローン |
User | arukuka |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 1710 Byte |
Status | WA |
Exec Time | 200 ms |
Memory | 13748 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | 0 / 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 | 123 ms | 9552 KB |
00_example_02.txt | AC | 122 ms | 9552 KB |
00_example_03.txt | AC | 123 ms | 9680 KB |
00_example_04.txt | AC | 122 ms | 9548 KB |
10_rand_01.txt | AC | 153 ms | 10068 KB |
10_rand_02.txt | AC | 135 ms | 9684 KB |
10_rand_03.txt | AC | 145 ms | 9808 KB |
10_rand_04.txt | AC | 142 ms | 9808 KB |
20_no_question_01.txt | AC | 151 ms | 10064 KB |
20_no_question_02.txt | AC | 126 ms | 9684 KB |
20_no_question_03.txt | AC | 142 ms | 9932 KB |
20_no_question_04.txt | AC | 141 ms | 9808 KB |
30_max_01.txt | AC | 181 ms | 12548 KB |
30_max_02.txt | AC | 189 ms | 12440 KB |
30_max_03.txt | AC | 188 ms | 12504 KB |
30_max_04.txt | AC | 191 ms | 13600 KB |
40_corner_01.txt | AC | 184 ms | 12560 KB |
40_corner_02.txt | AC | 189 ms | 12464 KB |
40_corner_03.txt | AC | 177 ms | 13224 KB |
40_corner_04.txt | AC | 191 ms | 13364 KB |
50_hand_01.txt | WA | 122 ms | 9552 KB |
50_hand_02.txt | WA | 121 ms | 9672 KB |
50_hand_03.txt | WA | 121 ms | 9672 KB |
60_rand_01.txt | AC | 152 ms | 10192 KB |
60_rand_02.txt | AC | 124 ms | 9552 KB |
60_rand_03.txt | WA | 138 ms | 9808 KB |
60_rand_04.txt | AC | 142 ms | 9680 KB |
70_no_ques_01.txt | AC | 151 ms | 10188 KB |
70_no_ques_02.txt | AC | 123 ms | 9680 KB |
70_no_ques_03.txt | WA | 140 ms | 9812 KB |
70_no_ques_04.txt | AC | 141 ms | 9808 KB |
80_max_01.txt | WA | 186 ms | 12532 KB |
80_max_02.txt | WA | 200 ms | 13748 KB |
80_max_03.txt | WA | 186 ms | 12572 KB |
80_max_04.txt | WA | 179 ms | 12584 KB |
90_corner_01.txt | WA | 178 ms | 12552 KB |
90_corner_02.txt | WA | 187 ms | 13356 KB |
90_corner_03.txt | WA | 191 ms | 13552 KB |
90_corner_04.txt | AC | 186 ms | 12844 KB |