結果
問題 | No.1605 Matrix Shape |
ユーザー |
|
提出日時 | 2024-02-12 23:17:58 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,241 bytes |
コンパイル時間 | 7,992 ms |
コンパイル使用メモリ | 167,488 KB |
実行使用メモリ | 212,556 KB |
最終ジャッジ日時 | 2024-09-28 18:13:36 |
合計ジャッジ時間 | 15,833 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 4 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (98 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/
ソースコード
using System;using static System.Console;using System.Linq;using System.Collections.Generic;class Program{static int NN => int.Parse(ReadLine());static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();public static void Main(){Solve();}static void Solve(){var n = NN;var map = NArr(n);var cin = new int[200001];var cout = new int[200001];var eq = new int[200001];foreach (var arr in map) if (arr[0] != arr[1]){++cin[arr[0]];++cout[arr[1]];}var scount = 0;for (var i = 0; i < cin.Length; ++i){if (cin[i] != cout[i]){scount += Math.Max(0, cin[i] - cout[i]);}}if (scount == 0){var set = new HashSet<int>(map.Select(mi => mi[0]));WriteLine(set.Count);}else if (scount == 1){WriteLine(1);}else{WriteLine(0);}}}