結果
| 問題 | No.197 手品 |
| コンテスト | |
| ユーザー |
tnodino
|
| 提出日時 | 2022-07-22 19:50:00 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 517 bytes |
| 記録 | |
| コンパイル時間 | 539 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 15,484 KB |
| 最終ジャッジ日時 | 2026-03-25 12:23:34 |
| 合計ジャッジ時間 | 6,936 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 23 |
ソースコード
from collections import deque
S = input()
memo = {}
memo[S] = 0
Queue = deque()
Queue.append((S, 0))
while Queue:
x,cnt = Queue.popleft()
y = x[1] + x[0] + x[2]
if not y in memo:
memo[y] = cnt + 1
Queue.append((y, cnt+1))
y = x[0] + x[2] + x[1]
if not y in memo:
memo[y] = cnt + 1
Queue.append((y, cnt+1))
N = int(input())
S = input()
if not S in memo:
print('SUCCESS')
elif memo[S] <= N and memo[S] % 2 == N % 2:
print('FAILURE')
else:
print('SUCCESS')
tnodino