結果

問題 No.2819 Binary Binary-Operator
ユーザー Shirotsume
提出日時 2024-07-26 23:27:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 94,048 KB
平均クエリ数 3.00
最終ジャッジ日時 2024-07-26 23:27:21
合計ジャッジ時間 9,904 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

x, y = mi()

def dfs(s):
    f = True
    for bit in range(1 << 4):
        op = [0] * 4
        for i in range(4):
            if bit >> i & 1:
                op[i] = 1
            else:
                op[i] = 0
        now = s[0]
        
        for v in s[1:]:
            now = op[2 * now + v]
        if op[2 * x + y] == now:
            pass
        else:
            f = False
    if len(s) >= 3 and f:
        print(len(s), flush=True)
        print(*s, flush=True)
        print(int(input()), flush=True)
        exit()
    if len(s) >= 10:
        return
    dfs(s + [0])
    dfs(s + [1])
    
dfs([0])
dfs([1])
0