結果

問題 No.3069 Torn Documents
ユーザー titiatitia
提出日時 2020-04-01 23:12:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 10,552 KB
最終ジャッジ日時 2023-09-29 02:55:19
合計ジャッジ時間 4,879 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 16 ms
7,796 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,816 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 20 ms
8,640 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 15 ms
7,788 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 16 ms
7,780 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 17 ms
7,840 KB
testcase_23 AC 16 ms
7,836 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B=map(int,input().split())
S=input()

NOW=[A,B]
USED=set()
USED.add((A,B))
ANS=[]

for s in S:
    if s=="L" and NOW[1]!=0:
        NOW[1]-=1
        USED.add(tuple(NOW))
    elif s=="U" and NOW[0]!=0:
        NOW[0]-=1
        USED.add(tuple(NOW))
    elif s=="R":
        x,y=NOW
        if (x,y+1) in USED:
            NOW=[x,y+1]
        else:
            ANS.append((x,y+1))

    elif s=="D":
        x,y=NOW
        if (x+1,y) in USED:
            NOW=[x+1,y]
        else:
            ANS.append((x+1,y))

print(len(ANS))
for x,y in ANS:
    print(x,y)
        
        
        
0