結果
問題 | No.1225 I hate I hate Matrix Construction |
ユーザー |
|
提出日時 | 2025-03-19 23:08:37 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 1,292 bytes |
コンパイル時間 | 8,319 ms |
コンパイル使用メモリ | 172,976 KB |
実行使用メモリ | 189,452 KB |
最終ジャッジ日時 | 2025-03-19 23:08:53 |
合計ジャッジ時間 | 12,554 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (104 ミリ秒)。 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 s = NList; var t = NList; var s2c = s.Count(c => c == 2); var t2c = t.Count(c => c == 2); if (s2c > 0 && t2c > 0) { WriteLine(s2c * n + t2c * n - s2c * t2c); } else if (s2c > 0) { var s1c = s.Count(c => c == 1); WriteLine(s2c * n + s1c); } else if (t2c > 0) { var t1c = t.Count(c => c == 1); WriteLine(t2c * n + t1c); } else { var s1c = s.Count(c => c == 1); var t1c = t.Count(c => c == 1); WriteLine(Math.Max(s1c, t1c)); } } static long GCD(long a, long b) { if (a < b) return GCD(b, a); if (a % b == 0) return b; return GCD(b, a % b); } }