結果

問題 No.519 アイドルユニット
ユーザー 6soukiti296soukiti29
提出日時 2017-07-08 09:39:21
言語 Nim
(2.0.2)
結果
TLE  
実行時間 -
コード長 844 bytes
コンパイル時間 3,613 ms
コンパイル使用メモリ 69,712 KB
実行使用メモリ 143,576 KB
最終ジャッジ日時 2023-09-12 13:18:05
合計ジャッジ時間 8,101 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,math

proc powInt(n : int64, m : int64, k = 1_000_000_007):int64 =
    if m == 0:
        return 1
    elif m == 1:
        return (n mod k)
    if (m mod 2) == 0:
        return powInt((n*n) mod k,m div 2, k) mod k
    else:
        return (powInt((n*n) mod k,m div 2, k) * n) mod k

proc p2(i : int):int =
    return powInt(2,i).int

var
    N = stdin.readline.parseInt
    A = newSeqWith(N,newSeq[int](0))
    x : int
    B = newSeqWith(p2(N),-1)
    T : seq[int]
for n in 0..<N:
    A[n] = stdin.readline.split.map(parseInt)

T = @[]
for k in 1..<N:
    for j in 0..<k:
        x = p2(k) + p2(j)
        B[x] = A[k][j]
        T.add(x)

for i in 1..<p2(N):
    if B[i] == -1:
        continue
    for t in T:
        if (i and t) == 0:
            B[i + t] = max(B[i + t],B[i] + B[t])

echo B[p2(N) - 1]
        


0