結果
問題 | No.517 壊れたアクセサリー |
ユーザー | roaris |
提出日時 | 2019-08-16 12:12:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 723 bytes |
コンパイル時間 | 240 ms |
コンパイル使用メモリ | 81,880 KB |
実行使用メモリ | 53,652 KB |
最終ジャッジ日時 | 2023-10-22 01:36:57 |
合計ジャッジ時間 | 2,035 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,652 KB |
testcase_01 | AC | 38 ms
53,652 KB |
testcase_02 | AC | 38 ms
53,652 KB |
testcase_03 | AC | 38 ms
53,652 KB |
testcase_04 | AC | 38 ms
53,652 KB |
testcase_05 | AC | 38 ms
53,652 KB |
testcase_06 | AC | 38 ms
53,652 KB |
testcase_07 | AC | 38 ms
53,652 KB |
testcase_08 | AC | 37 ms
53,652 KB |
testcase_09 | AC | 38 ms
53,652 KB |
testcase_10 | AC | 37 ms
53,652 KB |
testcase_11 | AC | 39 ms
53,652 KB |
testcase_12 | AC | 38 ms
53,652 KB |
testcase_13 | AC | 37 ms
53,652 KB |
testcase_14 | AC | 38 ms
53,652 KB |
testcase_15 | AC | 39 ms
53,652 KB |
testcase_16 | AC | 38 ms
53,652 KB |
testcase_17 | AC | 38 ms
53,652 KB |
testcase_18 | AC | 37 ms
53,652 KB |
ソースコード
N = int(input()) A = [input() for _ in range(N)] M = int(input()) B = [input() for _ in range(M)] for i in range(N): for j in range(M): if A[i][0] == B[j][0]: str0, str1 = A.pop(i), B.pop(j) break else: continue break while True: if str0 == str1: if len(A) == 0 and len(B) == 0: print(str0) else: print(-1) break if len(str0) > len(str1): for i in range(len(B)): if B[i][0] == str0[len(str1)]: str1 += B.pop(i) break else: for i in range(len(A)): if A[i][0] == str1[len(str0)]: str0 += A.pop(i) break