回答編集履歴
1
edit
answer
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
誤りの前提から来るバグを仕込んでいました。
|
2
|
+
修正点:
|
3
|
+
|
4
|
+
- 前提が必ず成立するように初手`sorted`を追加しました。
|
5
|
+
- どうせリストにするのなら見にくい`map`の使用をやめました。
|
6
|
+
|
1
7
|
```python
|
2
|
-
ps1 =
|
8
|
+
ps1 = sorted([int(x)-1 for x in input().split()])
|
3
|
-
ps2 =
|
9
|
+
ps2 = sorted([int(x)-1 for x in input().split()])
|
4
|
-
es =
|
10
|
+
es = [int(x) for x in input().split()]
|
5
|
-
fs =
|
11
|
+
fs = [int(x) for x in input().split()]
|
6
12
|
|
7
13
|
def play(p, s):
|
8
14
|
if s[0] < s[1]:
|
@@ -12,8 +18,8 @@
|
|
12
18
|
|
13
19
|
rs1 = play(ps1, [es[p] for p in ps1])
|
14
20
|
rs2 = play(ps2, [es[p] for p in ps2])
|
15
|
-
rs = play((rs1[0], rs2[0]), fs)
|
16
21
|
|
22
|
+
rs = play((rs1[0], rs2[0]), fs)
|
17
23
|
print(rs[0]+1)
|
18
24
|
print(rs[1]+1)
|
19
25
|
```
|