結果
問題 | No.812 Change of Class |
ユーザー | keymoon |
提出日時 | 2019-04-12 22:09:38 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 900 ms / 4,000 ms |
コード長 | 2,244 bytes |
コンパイル時間 | 2,817 ms |
コンパイル使用メモリ | 107,732 KB |
実行使用メモリ | 62,400 KB |
最終ジャッジ日時 | 2023-09-03 12:35:38 |
合計ジャッジ時間 | 27,136 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 554 ms
52,336 KB |
testcase_01 | AC | 142 ms
47,448 KB |
testcase_02 | AC | 337 ms
50,384 KB |
testcase_03 | AC | 619 ms
55,892 KB |
testcase_04 | AC | 588 ms
52,576 KB |
testcase_05 | AC | 900 ms
58,880 KB |
testcase_06 | AC | 795 ms
57,120 KB |
testcase_07 | AC | 60 ms
22,972 KB |
testcase_08 | AC | 58 ms
22,992 KB |
testcase_09 | AC | 830 ms
57,184 KB |
testcase_10 | AC | 844 ms
57,092 KB |
testcase_11 | AC | 90 ms
34,988 KB |
testcase_12 | AC | 511 ms
55,888 KB |
testcase_13 | AC | 62 ms
22,880 KB |
testcase_14 | AC | 61 ms
22,988 KB |
testcase_15 | AC | 579 ms
54,148 KB |
testcase_16 | AC | 90 ms
32,176 KB |
testcase_17 | AC | 510 ms
56,440 KB |
testcase_18 | AC | 410 ms
53,508 KB |
testcase_19 | AC | 460 ms
51,228 KB |
testcase_20 | AC | 890 ms
56,884 KB |
testcase_21 | AC | 395 ms
51,912 KB |
testcase_22 | AC | 207 ms
48,296 KB |
testcase_23 | AC | 82 ms
27,204 KB |
testcase_24 | AC | 101 ms
34,220 KB |
testcase_25 | AC | 174 ms
48,344 KB |
testcase_26 | AC | 658 ms
56,256 KB |
testcase_27 | AC | 608 ms
58,736 KB |
testcase_28 | AC | 445 ms
55,368 KB |
testcase_29 | AC | 147 ms
44,056 KB |
testcase_30 | AC | 547 ms
56,620 KB |
testcase_31 | AC | 493 ms
50,936 KB |
testcase_32 | AC | 249 ms
48,396 KB |
testcase_33 | AC | 548 ms
56,392 KB |
testcase_34 | AC | 94 ms
33,060 KB |
testcase_35 | AC | 149 ms
40,044 KB |
testcase_36 | AC | 102 ms
36,472 KB |
testcase_37 | AC | 300 ms
48,424 KB |
testcase_38 | AC | 64 ms
27,044 KB |
testcase_39 | AC | 307 ms
50,744 KB |
testcase_40 | AC | 121 ms
41,932 KB |
testcase_41 | AC | 64 ms
24,912 KB |
testcase_42 | AC | 602 ms
54,836 KB |
testcase_43 | AC | 123 ms
34,968 KB |
testcase_44 | AC | 459 ms
50,620 KB |
testcase_45 | AC | 100 ms
34,676 KB |
testcase_46 | AC | 113 ms
36,408 KB |
testcase_47 | AC | 433 ms
50,704 KB |
testcase_48 | AC | 426 ms
54,072 KB |
testcase_49 | AC | 171 ms
43,536 KB |
testcase_50 | AC | 63 ms
20,780 KB |
testcase_51 | AC | 156 ms
41,128 KB |
testcase_52 | AC | 235 ms
44,240 KB |
testcase_53 | AC | 139 ms
43,300 KB |
testcase_54 | AC | 132 ms
45,316 KB |
testcase_55 | AC | 481 ms
58,064 KB |
testcase_56 | AC | 649 ms
58,240 KB |
testcase_57 | AC | 671 ms
56,848 KB |
testcase_58 | AC | 367 ms
51,932 KB |
testcase_59 | AC | 737 ms
62,400 KB |
testcase_60 | AC | 58 ms
24,924 KB |
testcase_61 | AC | 60 ms
25,020 KB |
testcase_62 | AC | 59 ms
23,008 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
//#define topt using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Numerics; using System.Diagnostics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using static System.Math; using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions; using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute; class P { static void Main() { int[] nm = Console.ReadLine().Split().Select(int.Parse).ToArray(); List<int>[] neighbours = Enumerable.Repeat(0, nm[0]).Select(_ => new List<int>()).ToArray(); for (int i = 0; i < nm[1]; i++) { int[] ab = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray(); neighbours[ab[0]].Add(ab[1]); neighbours[ab[1]].Add(ab[0]); } int q = int.Parse(Console.ReadLine()); for (int i = 0; i < q; i++) { int query = int.Parse(Console.ReadLine()) - 1; var maxDepth = 0; var count = 0; HashSet<int> arrived = new HashSet<int>(); arrived.Add(query); Queue<Tuple<int, int>> stack = new Queue<Tuple<int, int>>(); foreach (var neighbour in neighbours[query]) { arrived.Add(neighbour); stack.Enqueue(new Tuple<int, int>(neighbour, 0)); } while (stack.Count > 0) { var elem = stack.Dequeue(); var index = elem.Item1; var depth = elem.Item2; count++; maxDepth = Max(maxDepth, depth); foreach (var neighbour in neighbours[index]) { if (arrived.Contains(neighbour)) continue; arrived.Add(neighbour); stack.Enqueue(new Tuple<int, int>(neighbour, depth + 1)); } } int depthLog = 0; while ((1 << depthLog) <= maxDepth) depthLog++; Console.WriteLine($"{count} {depthLog}"); } } }