結果
問題 | No.3029 オイラー標数 |
ユーザー |
|
提出日時 | 2025-02-21 22:19:20 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 366 ms / 2,000 ms |
コード長 | 1,905 bytes |
コンパイル時間 | 11,125 ms |
コンパイル使用メモリ | 172,676 KB |
実行使用メモリ | 246,032 KB |
最終ジャッジ日時 | 2025-02-21 22:19:50 |
合計ジャッジ時間 | 20,303 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (123 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;using static System.Console;using System.Linq;using System.Collections.Generic;class Program{static int NN => int.Parse(ReadLine());static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();public static void Main(){Solve();}static void Solve(){var q = NN;var map = NArr(q);var v = new HashSet<long>();var e = new HashSet<Bi>();var f = new HashSet<Tri>();foreach (var elm in map){v.Add(elm[0]);v.Add(elm[1]);v.Add(elm[2]);e.Add(new Bi(elm[0], elm[1]));e.Add(new Bi(elm[1], elm[2]));e.Add(new Bi(elm[0], elm[2]));f.Add(new Tri(elm[0], elm[1], elm[2]));}WriteLine(v.Count - e.Count + f.Count);}static int mod = 998_244_383;class Bi{long A;long B;public Bi(long a, long b){A = a; B = b;}public override int GetHashCode(){return (int)((A * 100_000_000 + B) % mod);}public override bool Equals(object obj){var o = (Bi)obj;return A == o.A && B == o.B;}}class Tri{long A;long B;long C;public Tri(long a, long b, long c){A = a; B = b; C = c;}public override int GetHashCode(){return (int)(((A * 100_000_000 + B) % mod * 100_000_000 + C) % mod);}public override bool Equals(object obj){var o = (Tri)obj;return A == o.A && B == o.B && C == o.C;}}}