結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2016-03-02 20:19:12 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 974 bytes |
コンパイル時間 | 372 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-27 13:20:38 |
合計ジャッジ時間 | 3,100 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 42 WA * 1 |
ソースコード
# -*- coding: utf-8 -*- from collections import Counter s1 = input() N = int(input()) s2 = input() cs1 = Counter(s1) cs2 = Counter(s2) if cs1 != cs2: # カウンターが異なれば成功 print('SUCCESS') elif cs1['o'] * cs1['x'] == 0: # 以下はカウンターが等しいとき # すべて'o', すべて'x'ならすべてあり得るので失敗 print('FAILURE') else: # ('o', 'x') = (1, 2), (2, 1)のとき if N >= 2: print('FAILURE') elif N == 0: if s1 == s2: print('FAILURE') else: print('SUCCESS') else: # N == 1 # 少ない方の文字を取得 c = '' if cs1['o'] == 1: c = 'o' else: c = 'x' if s1.index(c) == s2.index(c) == 1: print('SUCCESS') elif s1.index(c) % 2 == 0 and abs(s1.index(c) - s2.index(c) == 2): print('SUCCESS') else: print('FAILURE')