結果
| 問題 | No.197 手品 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-28 23:55:02 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 1,000 ms |
| + 136µs | |
| コード長 | 596 bytes |
| 記録 | |
| コンパイル時間 | 430 ms |
| コンパイル使用メモリ | 21,536 KB |
| 実行使用メモリ | 15,868 KB |
| 最終ジャッジ日時 | 2026-08-19 10:28:19 |
| 合計ジャッジ時間 | 6,988 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))