結果
問題 | No.792 真理関数をつくろう |
ユーザー | むらため |
提出日時 | 2019-05-17 19:15:22 |
言語 | Nim (2.0.2) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,567 bytes |
コンパイル時間 | 3,260 ms |
コンパイル使用メモリ | 75,264 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 01:32:22 |
合計ジャッジ時間 | 4,184 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 3 ms
5,376 KB |
testcase_06 | AC | 4 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 3 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | AC | 5 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 2 ms
5,376 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(5, 1) Warning: template 'times' is implicitly redefined; this is deprecated, add an explicit .redefine pragma [ImplicitTemplateRedefinition] /home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport]
ソースコード
import sequtils,strutils,times 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 times*(n:int,body) = (for _ in 0..<n: body) template stopwatch(body) = (let t1 = cpuTime();body;stderr.writeLine "TIME:",(cpuTime() - t1) * 1000,"ms") proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" ,discardable.} proc scan(): int = while true: let k = getchar_unlocked() if k < '0' : return result = 10 * result + k.ord - '0'.ord proc fputs(c: cstring, f: File) {.importc: "fputs", header: "<stdio.h>",tags: [WriteIOEffect].} template put(c:untyped) = fputs(cstring(c),stdout) proc funlockfile(f:File) {.importc: "funlockfile", header:"<stdio.h>" .} stdout.write "A=" let n = scan() var Q = newSeq[string]() if n == 1: 2.times: let q = scan() let r = scan() if r == 0 : continue if q == 0 : Q &= "(¬P_1)" else: Q &= "(P_1)" else: stopwatch: var arr = newSeq[int](n) (1 shl n).times: for i in 0..<n: arr[i] = scan() if scan() == 0 : continue var s = "(" if arr[0] == 0 : s &= "¬P_1" else: s &= "P_1" for j in 1..<n: if arr[j] == 0: s &= "∧¬P_" else: s &= "∧P_" if j+1 < 10: s &= ('0'.ord + (j+1).ord).chr else: s &= '1' s &= ('0'.ord + (j+1-10).ord).chr s &= ')' Q &= s if Q.len == 0 : quit "⊥",0 if Q.len == 1 shl n : quit "⊤",0 put Q[0] stopwatch: for i in 1..<Q.len: put "∨" put Q[i] put "\n"