結果
問題 |
No.785 色食い虫
|
ユーザー |
![]() |
提出日時 | 2019-02-23 21:56:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,702 bytes |
コンパイル時間 | 943 ms |
コンパイル使用メモリ | 115,804 KB |
実行使用メモリ | 28,880 KB |
最終ジャッジ日時 | 2024-12-14 14:16:20 |
合計ジャッジ時間 | 2,924 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 8 WA * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Numerics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; using Debug = System.Diagnostics.Debug; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; class Ph { static void Main() { Console.WriteLine((16 - Console.ReadLine().Split(',').Count()) * (16 - Console.ReadLine().Split(',').Count()) * (16 - Console.ReadLine().Split(',').Count())); } } class UnionFind { public int Size { get; private set; } List<int> parent; List<int> sizes; public UnionFind(int count) { Size = 0; parent = new List<int>(count); sizes = new List<int>(count); ExtendSize(count); } public bool Unite(int x, int y) { int xp = Find(x); int yp = Find(y); if (yp == xp) return false; if (sizes[xp] < sizes[yp]) { var tmp = xp; xp = yp; yp = tmp; } parent[yp] = xp; sizes[xp] += sizes[yp]; return true; } public IEnumerable<int> AllParents => parent.Where(x => x == parent[x]); public int GetSize(int x) => sizes[x]; public int Find(int x) => parent[x] == parent[parent[x]] ? parent[x] : parent[x] = Find(parent[x]); public void ExtendSize(int treeSize) { if (treeSize <= Size) return; parent.Capacity = treeSize; sizes.Capacity = treeSize; while (Size < treeSize) { parent.Add(Size); sizes.Add(1); Size++; } } }