結果

問題 No.5005 3-SAT
ユーザー nikumakare
提出日時 2024-07-22 20:33:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 952 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 77,896 KB
スコア 827
最終ジャッジ日時 2024-07-22 20:33:44
合計ジャッジ時間 13,733 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
import sys


def make_testcase():
    C = []
    for i in range(2048):
        C.append([int(i) for i in input().split()])

        # sub = []
        # for j in range(3):
        #     sub.append(random.randrange(256))
        #     sub.append(random.randint(0, 1))
        # C.append(sub[:])
    return C


C = make_testcase()

k = 0
nowans = k
nowscore = 0

table = [C[0]]
# print(table)
ends = 3
while 1:
    if ends == 0:
        break
    ends -= 1
    for row in table:
        if k >> row[0] & 1 == row[1]:
            continue
        if k >> row[2] & 1 == row[3]:
            continue
        if k >> row[4] & 1 == row[5]:
            continue

        tar = random.choice(row[::2])
        k ^= 1 << tar
        break
    else:
        nowscore += 1
        nowans = k
        # print(f"score={nowscore} sol={bin(k)[2:]}", file=sys.stderr)
        table.append(C[nowscore])
        ends = 6 * (nowscore + 1)

print(bin(k)[2:])
0