結果
問題 | No.3 ビットすごろく |
ユーザー | toshiro_yanagi |
提出日時 | 2018-06-16 16:22:59 |
言語 | Nim (2.0.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 3,585 ms |
コンパイル使用メモリ | 68,620 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-13 06:07:40 |
合計ジャッジ時間 | 13,396 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 72 ms
4,380 KB |
testcase_04 | AC | 9 ms
4,376 KB |
testcase_05 | AC | 319 ms
4,376 KB |
testcase_06 | AC | 87 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 300 ms
4,380 KB |
testcase_13 | AC | 52 ms
4,376 KB |
testcase_14 | AC | 665 ms
4,376 KB |
testcase_15 | AC | 1,022 ms
4,380 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 2 ms
4,380 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 1 ms
4,380 KB |
testcase_22 | AC | 681 ms
4,376 KB |
testcase_23 | AC | 1,046 ms
4,376 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 2 ms
4,376 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 2 ms
4,376 KB |
testcase_32 | WA | - |
コンパイルメッセージ
/home/judge/data/code/Main.nim(7, 29) Warning: Deprecated since v0.20, use 'initHashSet'; initSet is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import strutils, sequtils, sets proc trfm(i: int): int = i.toBin(16).count('1') let N = stdin.readLine.parseInt var arr = newSeq[int](N) ttl_S, mini_S1, mini_S2 = initSet[int]() x = 1 mini_S1.incl 0 arr[0] = 1 proc go(x: int) = for i0 in mini_S1: var i = i0 while true: let pre = i i += (i + 1).trfm * x if x == 1: if i >= N: break else: if i <= 0: break if i notin ttl_S: arr[i] = arr[pre] + 1 mini_S2.incl i ttl_S.incl i if mini_S2.len == 0: echo -1; quit() swap(mini_S1, mini_S2) mini_S2.clear while arr[^1] == 0: go(x) x *= -1 echo arr[^1]