結果
問題 | No.2888 Mamehinata |
ユーザー | tobisatis |
提出日時 | 2024-09-13 22:05:30 |
言語 | C# (.NET 8.0.203) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,473 bytes |
コンパイル時間 | 8,981 ms |
コンパイル使用メモリ | 170,124 KB |
実行使用メモリ | 188,996 KB |
最終ジャッジ日時 | 2024-09-13 22:06:05 |
合計ジャッジ時間 | 20,797 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
30,848 KB |
testcase_01 | AC | 66 ms
30,848 KB |
testcase_02 | AC | 66 ms
30,592 KB |
testcase_03 | AC | 66 ms
30,720 KB |
testcase_04 | WA | - |
testcase_05 | AC | 66 ms
30,592 KB |
testcase_06 | AC | 66 ms
30,848 KB |
testcase_07 | AC | 66 ms
30,592 KB |
testcase_08 | AC | 66 ms
30,576 KB |
testcase_09 | AC | 66 ms
30,464 KB |
testcase_10 | AC | 66 ms
30,592 KB |
testcase_11 | WA | - |
testcase_12 | AC | 65 ms
30,464 KB |
testcase_13 | AC | 130 ms
54,008 KB |
testcase_14 | AC | 117 ms
48,780 KB |
testcase_15 | WA | - |
testcase_16 | AC | 244 ms
68,736 KB |
testcase_17 | WA | - |
testcase_18 | AC | 171 ms
62,816 KB |
testcase_19 | AC | 246 ms
69,120 KB |
testcase_20 | AC | 217 ms
66,964 KB |
testcase_21 | AC | 233 ms
66,900 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 242 ms
73,508 KB |
testcase_25 | AC | 199 ms
65,800 KB |
testcase_26 | AC | 214 ms
70,864 KB |
testcase_27 | AC | 146 ms
58,556 KB |
testcase_28 | AC | 103 ms
42,112 KB |
testcase_29 | AC | 150 ms
53,528 KB |
testcase_30 | AC | 302 ms
72,608 KB |
testcase_31 | AC | 230 ms
69,248 KB |
testcase_32 | AC | 185 ms
62,084 KB |
testcase_33 | AC | 225 ms
69,564 KB |
testcase_34 | AC | 203 ms
61,260 KB |
testcase_35 | AC | 181 ms
60,692 KB |
testcase_36 | AC | 309 ms
71,024 KB |
testcase_37 | AC | 321 ms
74,624 KB |
testcase_38 | AC | 142 ms
52,724 KB |
testcase_39 | AC | 265 ms
68,596 KB |
testcase_40 | AC | 325 ms
71,292 KB |
testcase_41 | AC | 113 ms
43,120 KB |
testcase_42 | AC | 275 ms
68,380 KB |
testcase_43 | AC | 228 ms
69,924 KB |
testcase_44 | AC | 248 ms
72,136 KB |
testcase_45 | AC | 273 ms
78,260 KB |
testcase_46 | AC | 100 ms
41,344 KB |
testcase_47 | AC | 242 ms
71,572 KB |
testcase_48 | AC | 223 ms
71,720 KB |
testcase_49 | AC | 102 ms
43,520 KB |
testcase_50 | AC | 157 ms
63,488 KB |
testcase_51 | AC | 75 ms
32,896 KB |
testcase_52 | AC | 67 ms
31,104 KB |
testcase_53 | AC | 88 ms
37,248 KB |
testcase_54 | WA | - |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (96 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
namespace AtCoder; #nullable enable using System.Numerics; class Graph<T> { public struct Edge { public int Ab { get; set; } public int Ad { get; set; } public T Distance { get; set; } } public int N { get; private init; } public bool Directed { get; private init; } public List<List<(int next, int edgeIndex)>> AdjacencyList { get; private init; } public List<Edge> Edges { get; private init; } public Graph(int verticals, IReadOnlyList<Edge> edges, bool directed) { N = verticals; Directed = directed; AdjacencyList = new List<List<(int, int)>>(); for (var i = 0; i < N; i++) AdjacencyList.Add(new List<(int, int)>()); Edges = new List<Edge>(); for (var i = 0; i < edges.Count; i++) { var edge = edges[i]; Edges.Add(edge); AdjacencyList[edge.Ab].Add((edge.Ad, i)); if (!Directed) AdjacencyList[edge.Ad].Add((edge.Ab, i)); } } } class GraphBuilder { public static Graph<int> SimpleGraph(int verticals, (int ab, int ad)[] edges, bool directed) { var e = edges.Select(e => new Graph<int>.Edge { Ab = e.ab, Ad = e.ad, Distance = 1 }).ToList(); return new(verticals, e, directed); } } static class Extensions { public static T[] Repeat<T>(this int time, Func<T> F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); } class AtCoder { object? Solve() { var n = Int(); var m = Int(); var edges = m.Repeat(() => (Int() - 1, Int() - 1)); var g = GraphBuilder.SimpleGraph(n, edges, false).AdjacencyList; var xz = n.Repeat(() => n + 1); var q = new Queue<int>(); xz[0] = 0; q.Enqueue(0); while (q.Count > 0) { var v = q.Dequeue(); var w = xz[v]; foreach (var (next, _) in g[v]) { if (xz[next] <= w + 1) continue; xz[next] = w + 1; q.Enqueue(next); } } var az = new int[n + 1]; for (var i = 0; i < n; i++) { var j = xz[i]; if (j <= n) az[j]++; } for (var i = 2; i <= n; i++) az[i] += az[i - 2]; Out(az.Skip(1)); return null; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty<string>(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Trim().Split(' '), 0); return input[iter++]; } T Input<T>() where T : IParsable<T> => T.Parse(String(), null); int Int() => Input<int>(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } }