結果
問題 | No.50 おもちゃ箱 |
ユーザー | むらため |
提出日時 | 2019-01-29 04:30:47 |
言語 | Nim (2.0.2) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,253 bytes |
コンパイル時間 | 3,870 ms |
コンパイル使用メモリ | 77,844 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 11:07:41 |
合計ジャッジ時間 | 4,766 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 4 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,948 KB |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 2 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | WA | - |
testcase_16 | AC | 2 ms
6,944 KB |
testcase_17 | AC | 2 ms
6,944 KB |
testcase_18 | AC | 2 ms
6,944 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 3 ms
6,944 KB |
testcase_23 | AC | 2 ms
6,940 KB |
testcase_24 | AC | 1 ms
6,944 KB |
testcase_25 | AC | 2 ms
6,944 KB |
testcase_26 | AC | 1 ms
6,944 KB |
testcase_27 | AC | 2 ms
6,940 KB |
testcase_28 | AC | 3 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 2 ms
6,940 KB |
testcase_31 | AC | 2 ms
6,940 KB |
testcase_32 | AC | 2 ms
6,944 KB |
testcase_33 | AC | 2 ms
6,940 KB |
testcase_34 | AC | 3 ms
6,944 KB |
testcase_35 | AC | 2 ms
6,944 KB |
testcase_36 | AC | 3 ms
6,940 KB |
testcase_37 | AC | 2 ms
6,940 KB |
testcase_38 | AC | 2 ms
6,944 KB |
testcase_39 | AC | 3 ms
6,940 KB |
testcase_40 | AC | 3 ms
6,944 KB |
testcase_41 | AC | 2 ms
6,940 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(59, 9) Warning: assign is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 45) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport] /home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'strscans' [UnusedImport] /home/judge/data/code/Main.nim(1, 50) Warning: imported and not used: 'sugar' [UnusedImport]
ソースコード
import sequtils,strutils,strscans,algorithm,math,sugar,macros import sets,tables,intsets template `max=`*(x,y:typed):void = x = max(x,y) proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} template `^`(n:int) : int = (1 shl n) proc scan(): int = while true: let k = getchar_unlocked() if k < '0': return result = 10 * result + k.ord - '0'.ord proc putchar_unlocked(c:char){. importc:"putchar_unlocked",header: "<stdio.h>" .} proc printInt(a0:int32) = if a0 < 0 : putchar_unlocked('-') var a0 = a0.abs template div10(a:int32) : int32 = cast[int32]((0x1999999A * cast[int64](a)) shr 32) template put(n:int32) = putchar_unlocked("0123456789"[n]) proc getPrintIntNimCode(n,maxA:static[int32]):string = result = "if a0 < " & $maxA & ":\n" for i in 1..n: result &= " let a" & $i & " = a" & $(i-1) & ".div10\n" result &= " put(a" & $n & ")\n" for i in n.countdown(1): result &= " put(a" & $(i-1) & "-a" & $i & "*10)\n" result &= " return" macro eval(s:static[string]): auto = parseStmt(s) eval(getPrintIntNimCode(0,10)) eval(getPrintIntNimCode(1,100)) eval(getPrintIntNimCode(2,1000)) eval(getPrintIntNimCode(3,10000)) eval(getPrintIntNimCode(4,100000)) eval(getPrintIntNimCode(5,1000000)) eval(getPrintIntNimCode(6,10000000)) eval(getPrintIntNimCode(7,100000000)) eval(getPrintIntNimCode(8,1000000000)) template printInt(n:int,c:char) = printInt(n.int32) putchar_unlocked(c) let n = scan() let A = newSeqWith(n,scan()).sorted(cmp,Descending) let m = scan() let B = newSeqWith(m,scan()).sorted(cmp,Descending) var state = newSeq[int](^n) for ni in 0..<(^n): for ia in 0..<n: if (ni and ^ia) != ^ia : continue state[ni] += A[ia] # 各状態の体積の和 proc getOKState(b:int): IntSet = result = initIntSet() for i,s in state: if b - s >= 0 : result.incl(i) var ans = B[0].getOKState() if ^n - 1 in ans: quit("1",0) for i,b in B[1..^1]: var n_ans : IntSet n_ans.assign(ans) for x in b.getOKState().items: for y in ans.items: if (x and y) != 0 : continue n_ans.incl(x xor y) ans = n_ans if ^n - 1 in ans: printInt(i + 2,'\n') quit 0 putchar_unlocked('-') putchar_unlocked('1') putchar_unlocked('\n')