結果

問題 No.517 壊れたアクセサリー
ユーザー GrayCoderGrayCoder
提出日時 2017-05-28 22:16:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 486 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 11,852 KB
実行使用メモリ 14,416 KB
最終ジャッジ日時 2023-10-21 14:17:49
合計ジャッジ時間 4,262 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
14,416 KB
testcase_01 AC 26 ms
10,044 KB
testcase_02 AC 26 ms
10,044 KB
testcase_03 AC 26 ms
10,044 KB
testcase_04 AC 25 ms
10,044 KB
testcase_05 AC 26 ms
10,044 KB
testcase_06 AC 25 ms
10,044 KB
testcase_07 AC 24 ms
10,044 KB
testcase_08 AC 25 ms
10,044 KB
testcase_09 AC 25 ms
10,044 KB
testcase_10 AC 24 ms
10,044 KB
testcase_11 AC 25 ms
10,044 KB
testcase_12 AC 24 ms
10,044 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def main():
    N = int(input())
    A = [input() for i in range(N)]
    M = int(input())
    B = [input() for i in range(M)]

    cnt = 0
    for a in itertools.permutations(A):
        a_ = ''.join(a)
        for b in itertools.permutations(B):
            b_ = ''.join(b)
            if a_ == b_:
                ans = b_
                cnt += 1
            if cnt > 1:
                break

    if cnt > 1:
        print(-1)
    else:
        print(ans)

main()
0