結果

問題 No.792 真理関数をつくろう
ユーザー むらためむらため
提出日時 2019-05-17 11:58:08
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,037 bytes
コンパイル時間 3,680 ms
コンパイル使用メモリ 71,088 KB
実行使用メモリ 5,688 KB
最終ジャッジ日時 2023-09-14 18:28:25
合計ジャッジ時間 4,529 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 9 ms
4,824 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 15 ms
5,688 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,strformat
template times*(n:int,body) = (for _ in 0..<n: body)
template `max=`*(x,y) = x = max(x,y)
template `min=`*(x,y) = x = min(x,y)
# template stopwatch(body) = (let t1 = cpuTime();body;stderr.writeLine "TIME:",(cpuTime() - t1) * 1000,"ms")
proc `^^`(n:int) : int{.inline.} = (1 shl n)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" ,discardable.}
proc scan(): int =
  var read = false
  while true:
    let k = getchar_unlocked()
    if k < '0' :
      if not read: continue
      return
    result = 10 * result + k.ord - '0'.ord
    read = true

let n = scan()
let QR = newSeqWith(^^n,newSeqWith(n+1,scan()))
stdout.write "A="
if QR.allIt(it[^1] == 0): quit "⊥",0
if QR.allIt(it[^1] == 1): quit "⊤",0
var anss = newSeq[string]()
for qr in QR:
  if qr[^1] == 0 : continue
  var ans = newSeq[string]()
  for j in 0..<n:
    var s = ""
    if qr[j] == 0 : s &= "¬"
    s &= fmt"P_{j+1}"
    ans &= s
  anss &= ans.join("∧")
echo anss.mapIt("(" & it & ")").join("∨")
0