結果
問題 | No.3 ビットすごろく |
ユーザー | Adamantite |
提出日時 | 2023-06-29 21:19:49 |
言語 | C# (.NET 8.0.203) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,161 bytes |
コンパイル時間 | 16,173 ms |
コンパイル使用メモリ | 146,396 KB |
実行使用メモリ | 63,476 KB |
最終ジャッジ日時 | 2023-09-20 16:20:20 |
合計ジャッジ時間 | 51,590 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
28,944 KB |
testcase_01 | AC | 54 ms
28,840 KB |
testcase_02 | AC | 53 ms
28,976 KB |
testcase_03 | AC | 65 ms
31,312 KB |
testcase_04 | AC | 58 ms
29,260 KB |
testcase_05 | AC | 206 ms
54,328 KB |
testcase_06 | AC | 66 ms
31,536 KB |
testcase_07 | AC | 59 ms
30,084 KB |
testcase_08 | AC | 106 ms
41,700 KB |
testcase_09 | AC | 922 ms
54,864 KB |
testcase_10 | AC | 2,372 ms
57,788 KB |
testcase_11 | AC | 591 ms
53,160 KB |
testcase_12 | AC | 179 ms
54,384 KB |
testcase_13 | AC | 63 ms
31,020 KB |
testcase_14 | AC | 2,013 ms
55,508 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 3,034 ms
55,548 KB |
testcase_17 | AC | 4,623 ms
56,656 KB |
testcase_18 | AC | 60 ms
30,360 KB |
testcase_19 | TLE | - |
testcase_20 | AC | 55 ms
29,380 KB |
testcase_21 | AC | 54 ms
29,240 KB |
testcase_22 | AC | 2,106 ms
55,892 KB |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
コンパイルメッセージ
Determining projects to restore... Restored /home/judge/data/code/main.csproj (in 131 ms). .NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f Copyright (C) Microsoft Corporation.All rights reserved. プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください main -> /home/judge/data/code/bin/Release/net6.0/main.dll main -> /home/judge/data/code/bin/Release/net6.0/publish/
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace No00003_BitSugoroku { internal class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] map = new int[n + 1]; map[1] = 1; Queue<int> q = new Queue<int>(); q.Enqueue(1); while (0 < q.Count) { int x = q.Dequeue(); if(x == n) { break; } int diff = Convert.ToString(x, 2).Count(x => x == '1'); if (x + diff <= n) { if (map[x + diff] == 0 || map[x] < map[x + diff]) { q.Enqueue(x + diff); map[x + diff] = map[x] + 1; } } if (0 < x - diff) { if (map[x - diff] == 0 || map[x] < map[x - diff]) { q.Enqueue(x - diff); map[x - diff] = map[x] + 1; } } } Console.WriteLine(map[n] == 0 ? -1: map[n]); } } }