結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-28 23:55:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 1,000 ms |
| コード長 | 596 bytes |
| コンパイル時間 | 93 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-07-20 03:34:22 |
| 合計ジャッジ時間 | 2,789 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
s2p = {'oox': 2, 'oxo': 1, 'xoo': 0,
'xxo': 2, 'xox': 1, 'oxx': 0}
def solve(s_before, N, s_after):
if s_before.count('o') != s_after.count('o'):
return 'SUCCESS'
if s_before.count('o') == 0 or s_before.count('o') == 3:
return 'FAILURE'
p0 = s2p[s_before]
p1 = s2p[s_after]
if N == 0 and p0 != p1:
return 'SUCCESS'
if N == 1:
if abs(p0 - p1) == 2 or (p0 == 1 and p1 == 1):
return 'SUCCESS'
return 'FAILURE'
s_before = input().rstrip()
N = int(input())
s_after = input().rstrip()
print(solve(s_before, N, s_after))