結果

問題 No.5005 3-SAT
ユーザー titan23titan23
提出日時 2022-06-24 13:06:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,907 ms / 2,000 ms
コード長 1,312 bytes
コンパイル時間 259 ms
実行使用メモリ 86,284 KB
スコア 642
最終ジャッジ日時 2022-06-24 13:09:47
合計ジャッジ時間 195,485 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,887 ms
85,264 KB
testcase_01 AC 1,886 ms
85,044 KB
testcase_02 AC 1,887 ms
85,408 KB
testcase_03 AC 1,890 ms
85,400 KB
testcase_04 AC 1,900 ms
85,304 KB
testcase_05 AC 1,887 ms
85,620 KB
testcase_06 AC 1,890 ms
85,456 KB
testcase_07 AC 1,888 ms
85,036 KB
testcase_08 AC 1,889 ms
85,120 KB
testcase_09 AC 1,898 ms
85,096 KB
testcase_10 AC 1,889 ms
85,276 KB
testcase_11 AC 1,889 ms
85,308 KB
testcase_12 AC 1,888 ms
85,540 KB
testcase_13 AC 1,890 ms
85,304 KB
testcase_14 AC 1,897 ms
85,360 KB
testcase_15 AC 1,886 ms
85,728 KB
testcase_16 AC 1,888 ms
85,012 KB
testcase_17 AC 1,888 ms
85,852 KB
testcase_18 AC 1,887 ms
84,788 KB
testcase_19 AC 1,899 ms
85,900 KB
testcase_20 AC 1,890 ms
85,376 KB
testcase_21 AC 1,888 ms
85,828 KB
testcase_22 AC 1,893 ms
85,612 KB
testcase_23 AC 1,888 ms
85,324 KB
testcase_24 AC 1,901 ms
86,212 KB
testcase_25 AC 1,889 ms
85,684 KB
testcase_26 AC 1,889 ms
85,848 KB
testcase_27 AC 1,891 ms
85,852 KB
testcase_28 AC 1,902 ms
85,948 KB
testcase_29 AC 1,900 ms
85,988 KB
testcase_30 AC 1,889 ms
85,060 KB
testcase_31 AC 1,889 ms
85,152 KB
testcase_32 AC 1,887 ms
85,612 KB
testcase_33 AC 1,890 ms
85,268 KB
testcase_34 AC 1,899 ms
85,844 KB
testcase_35 AC 1,887 ms
86,100 KB
testcase_36 AC 1,889 ms
85,100 KB
testcase_37 AC 1,887 ms
85,092 KB
testcase_38 AC 1,888 ms
85,660 KB
testcase_39 AC 1,906 ms
85,464 KB
testcase_40 AC 1,890 ms
85,904 KB
testcase_41 AC 1,888 ms
85,764 KB
testcase_42 AC 1,888 ms
84,940 KB
testcase_43 AC 1,889 ms
85,512 KB
testcase_44 AC 1,898 ms
85,964 KB
testcase_45 AC 1,888 ms
85,628 KB
testcase_46 AC 1,890 ms
85,628 KB
testcase_47 AC 1,890 ms
85,712 KB
testcase_48 AC 1,889 ms
85,500 KB
testcase_49 AC 1,888 ms
85,576 KB
testcase_50 AC 1,892 ms
85,192 KB
testcase_51 AC 1,907 ms
85,320 KB
testcase_52 AC 1,889 ms
85,800 KB
testcase_53 AC 1,888 ms
86,152 KB
testcase_54 AC 1,888 ms
84,956 KB
testcase_55 AC 1,888 ms
85,164 KB
testcase_56 AC 1,888 ms
85,248 KB
testcase_57 AC 1,886 ms
85,084 KB
testcase_58 AC 1,890 ms
85,496 KB
testcase_59 AC 1,887 ms
85,596 KB
testcase_60 AC 1,888 ms
85,472 KB
testcase_61 AC 1,890 ms
84,988 KB
testcase_62 AC 1,887 ms
85,052 KB
testcase_63 AC 1,889 ms
85,748 KB
testcase_64 AC 1,895 ms
85,744 KB
testcase_65 AC 1,906 ms
85,068 KB
testcase_66 AC 1,903 ms
86,284 KB
testcase_67 AC 1,894 ms
85,580 KB
testcase_68 AC 1,890 ms
86,208 KB
testcase_69 AC 1,889 ms
86,056 KB
testcase_70 AC 1,890 ms
85,560 KB
testcase_71 AC 1,887 ms
85,248 KB
testcase_72 AC 1,890 ms
85,716 KB
testcase_73 AC 1,889 ms
85,768 KB
testcase_74 AC 1,889 ms
86,164 KB
testcase_75 AC 1,889 ms
85,884 KB
testcase_76 AC 1,887 ms
85,804 KB
testcase_77 AC 1,888 ms
85,304 KB
testcase_78 AC 1,887 ms
86,056 KB
testcase_79 AC 1,892 ms
84,976 KB
testcase_80 AC 1,888 ms
85,928 KB
testcase_81 AC 1,886 ms
84,892 KB
testcase_82 AC 1,888 ms
84,892 KB
testcase_83 AC 1,888 ms
85,988 KB
testcase_84 AC 1,890 ms
85,280 KB
testcase_85 AC 1,888 ms
85,228 KB
testcase_86 AC 1,886 ms
85,712 KB
testcase_87 AC 1,889 ms
85,188 KB
testcase_88 AC 1,889 ms
85,608 KB
testcase_89 AC 1,888 ms
85,772 KB
testcase_90 AC 1,889 ms
85,480 KB
testcase_91 AC 1,895 ms
85,444 KB
testcase_92 AC 1,902 ms
85,980 KB
testcase_93 AC 1,901 ms
85,316 KB
testcase_94 AC 1,895 ms
85,996 KB
testcase_95 AC 1,888 ms
85,028 KB
testcase_96 AC 1,887 ms
85,616 KB
testcase_97 AC 1,889 ms
85,652 KB
testcase_98 AC 1,886 ms
85,240 KB
testcase_99 AC 1,888 ms
85,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import random
from time import time

input = lambda: sys.stdin.readline().rstrip()

random.seed = 1
randint = random.randint
random = random.random

#  -----------------------  #

abcpqr = [tuple(map(int, input().split())) for _ in range(2048)]
STIME = time()

li = [[0, 0] for _ in range(2048)]
for a,b,c,p,q,r in abcpqr:
  li[a][p] += 1
  li[b][q] += 1
  li[c][r] += 1


def make_ans_init() -> list:
  ans = [-1] * 2048
  for a,b,c,p,q,r in abcpqr:
    if ans[a] != -1 or ans[b] != -1 or ans[c] != -1:
      continue
    ans[a] = p
    ans[b] = q
    ans[c] = r
  for i in range(2048):
    if ans[i] == -1:
      if li[i][0] < li[i][1]:
        ans[i] = 1
      else:
        ans[i] = 0 
  return ans


def eval_ans(ans) -> int:
  ret = 0
  for a,b,c,p,q,r in abcpqr:
    if ans[a] == p and ans[b] == q and ans[c] == r:
      ret += 1
  return ret


def make_ans_yamanobori(ans):
  preans = ans[:]
  for _ in range(2):
    indx = randint(0, 2047)
    ans[indx] = 1 - ans[indx]
  return preans


def main():
  ans = make_ans_init()
  vestscore = eval_ans(ans)
  while time() - STIME < 1.8:
    nans = make_ans_yamanobori(ans)
    score = eval_ans(nans)
    if score > vestscore:
      ans = nans[:]
      vestscore = score
  print(''.join(map(str, ans)))
  print(vestscore, file=sys.stderr)


main()
0