結果

問題 No.5005 3-SAT
ユーザー titan23titan23
提出日時 2022-06-24 12:40:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,922 ms / 2,000 ms
コード長 1,314 bytes
コンパイル時間 301 ms
実行使用メモリ 86,332 KB
スコア 780
最終ジャッジ日時 2022-06-24 12:43:52
合計ジャッジ時間 197,901 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,922 ms
85,448 KB
testcase_01 AC 1,911 ms
85,992 KB
testcase_02 AC 1,908 ms
85,624 KB
testcase_03 AC 1,903 ms
85,464 KB
testcase_04 AC 1,903 ms
85,452 KB
testcase_05 AC 1,905 ms
85,600 KB
testcase_06 AC 1,903 ms
85,868 KB
testcase_07 AC 1,903 ms
85,408 KB
testcase_08 AC 1,903 ms
85,956 KB
testcase_09 AC 1,902 ms
85,472 KB
testcase_10 AC 1,907 ms
85,388 KB
testcase_11 AC 1,907 ms
85,472 KB
testcase_12 AC 1,908 ms
85,872 KB
testcase_13 AC 1,905 ms
85,524 KB
testcase_14 AC 1,906 ms
85,392 KB
testcase_15 AC 1,909 ms
85,752 KB
testcase_16 AC 1,903 ms
85,284 KB
testcase_17 AC 1,903 ms
85,640 KB
testcase_18 AC 1,900 ms
85,364 KB
testcase_19 AC 1,904 ms
85,428 KB
testcase_20 AC 1,905 ms
85,764 KB
testcase_21 AC 1,908 ms
85,448 KB
testcase_22 AC 1,905 ms
86,332 KB
testcase_23 AC 1,905 ms
85,128 KB
testcase_24 AC 1,901 ms
85,260 KB
testcase_25 AC 1,905 ms
85,448 KB
testcase_26 AC 1,908 ms
85,584 KB
testcase_27 AC 1,904 ms
86,300 KB
testcase_28 AC 1,916 ms
85,784 KB
testcase_29 AC 1,910 ms
85,348 KB
testcase_30 AC 1,921 ms
85,760 KB
testcase_31 AC 1,917 ms
85,960 KB
testcase_32 AC 1,917 ms
85,388 KB
testcase_33 AC 1,913 ms
86,084 KB
testcase_34 AC 1,905 ms
85,244 KB
testcase_35 AC 1,902 ms
85,932 KB
testcase_36 AC 1,901 ms
85,536 KB
testcase_37 AC 1,903 ms
85,680 KB
testcase_38 AC 1,902 ms
85,676 KB
testcase_39 AC 1,904 ms
85,692 KB
testcase_40 AC 1,902 ms
85,328 KB
testcase_41 AC 1,902 ms
85,552 KB
testcase_42 AC 1,900 ms
85,128 KB
testcase_43 AC 1,900 ms
86,104 KB
testcase_44 AC 1,901 ms
85,376 KB
testcase_45 AC 1,900 ms
85,816 KB
testcase_46 AC 1,901 ms
85,308 KB
testcase_47 AC 1,902 ms
85,536 KB
testcase_48 AC 1,901 ms
85,380 KB
testcase_49 AC 1,902 ms
85,628 KB
testcase_50 AC 1,903 ms
85,524 KB
testcase_51 AC 1,904 ms
85,840 KB
testcase_52 AC 1,900 ms
85,900 KB
testcase_53 AC 1,904 ms
85,604 KB
testcase_54 AC 1,903 ms
85,312 KB
testcase_55 AC 1,900 ms
85,440 KB
testcase_56 AC 1,913 ms
85,652 KB
testcase_57 AC 1,903 ms
85,172 KB
testcase_58 AC 1,902 ms
85,976 KB
testcase_59 AC 1,905 ms
85,476 KB
testcase_60 AC 1,905 ms
85,504 KB
testcase_61 AC 1,905 ms
85,228 KB
testcase_62 AC 1,905 ms
85,872 KB
testcase_63 AC 1,903 ms
86,000 KB
testcase_64 AC 1,905 ms
85,960 KB
testcase_65 AC 1,905 ms
85,668 KB
testcase_66 AC 1,914 ms
85,372 KB
testcase_67 AC 1,912 ms
85,480 KB
testcase_68 AC 1,912 ms
85,676 KB
testcase_69 AC 1,910 ms
85,932 KB
testcase_70 AC 1,912 ms
85,676 KB
testcase_71 AC 1,909 ms
85,344 KB
testcase_72 AC 1,912 ms
85,840 KB
testcase_73 AC 1,905 ms
85,220 KB
testcase_74 AC 1,900 ms
85,296 KB
testcase_75 AC 1,904 ms
85,504 KB
testcase_76 AC 1,912 ms
85,516 KB
testcase_77 AC 1,907 ms
85,288 KB
testcase_78 AC 1,903 ms
85,308 KB
testcase_79 AC 1,907 ms
85,328 KB
testcase_80 AC 1,900 ms
85,860 KB
testcase_81 AC 1,898 ms
85,368 KB
testcase_82 AC 1,898 ms
85,100 KB
testcase_83 AC 1,901 ms
85,584 KB
testcase_84 AC 1,900 ms
85,320 KB
testcase_85 AC 1,904 ms
85,380 KB
testcase_86 AC 1,916 ms
85,564 KB
testcase_87 AC 1,900 ms
85,288 KB
testcase_88 AC 1,903 ms
85,672 KB
testcase_89 AC 1,902 ms
86,140 KB
testcase_90 AC 1,903 ms
85,576 KB
testcase_91 AC 1,905 ms
85,440 KB
testcase_92 AC 1,903 ms
85,792 KB
testcase_93 AC 1,900 ms
85,088 KB
testcase_94 AC 1,899 ms
85,720 KB
testcase_95 AC 1,901 ms
85,324 KB
testcase_96 AC 1,905 ms
85,256 KB
testcase_97 AC 1,902 ms
85,556 KB
testcase_98 AC 1,903 ms
85,676 KB
testcase_99 AC 1,903 ms
86,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
import random
from time import time

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(5):
    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, reversed(ans))))
  print(vestscore, file=sys.stderr)

main()
0