結果

問題 No.54 Happy Hallowe'en
ユーザー 6soukiti296soukiti29
提出日時 2017-07-29 19:11:35
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 3,653 ms
コンパイル使用メモリ 71,992 KB
実行使用メモリ 15,016 KB
最終ジャッジ日時 2023-09-12 13:45:55
合計ジャッジ時間 23,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 8 ms
7,124 KB
testcase_02 WA -
testcase_03 AC 7 ms
7,096 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 6 ms
7,100 KB
testcase_11 AC 6 ms
7,092 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(8, 9) Warning: Deprecated since v0.20, use 'initHashSet'; initSet is deprecated [Deprecated]

ソースコード

diff #

import sequtils,strutils,algorithm,sets

type
    ie = tuple[v,t : int]
var
    N = stdin.readline.parseInt
    kinjo = newSeq[ie](N)
    s = initSet[int](32768)
    s2 = s
    a,b : int
    ans = newSeq[int](0)
    Mi : ie
for n in 0..<N:
    (a,b) = stdin.readline.split.map(parseInt)
    kinjo[n] = ((a,b))
    if Mi.t < a:
        Mi = (a,b)

kinjo = kinjo.sortedByIt(it.t)
kinjo.add(Mi)
for k in kinjo:
    s2.clear
    for i in s:
        if i >= k.t:
            break
        else:
            s2.incl(i + k.v)
    s2.incl(k.v)
    s = union(s,s2)
for t in s:
    ans.add(t)
echo max(ans)
0