結果
| 問題 |
No.517 壊れたアクセサリー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-28 22:59:00 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 674 bytes |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-21 15:46:14 |
| 合計ジャッジ時間 | 1,628 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 RE * 2 |
| other | AC * 4 WA * 2 RE * 9 |
ソースコード
import itertools
import sys
def main():
N = int(input())
A = [input() for i in range(N)]
M = int(input())
B = [input() for i in range(M)]
for a in A:
if len(a) > 1:
break
else:
ans = -1
for b in B:
if len(b) > 1:
break
else:
ans = -1
if tuple(sorted(A)) == tuple(sorted(B)):
ans = -1
if ans == -1:
print(-1)
sys.exit()
for a in itertools.permutations(A):
a_ = ''.join(a)
for b in itertools.permutations(B):
b_ = ''.join(b)
if a_ == b_:
ans = b_
break
print(ans)
main()