結果
問題 | No.2615 ペアの作り方 |
ユーザー |
|
提出日時 | 2024-01-26 21:30:44 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 130 ms / 2,000 ms |
コード長 | 1,022 bytes |
コンパイル時間 | 7,139 ms |
コンパイル使用メモリ | 168,056 KB |
実行使用メモリ | 210,232 KB |
最終ジャッジ日時 | 2024-09-28 07:42:34 |
合計ジャッジ時間 | 9,639 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 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[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray();static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray();public static void Main(){Solve();}static void Solve(){var n = NN;var a = NList;var b = NList;var aset = new HashSet<int>(a);var all = new List<int>(a);all.AddRange(b);all.Sort();var acnt = 0;for (var i = 0; i < n; ++i) if (aset.Contains(all[i])) ++acnt;var ans = 1L;var mod = 998_244_353;for (var i = 0; i < acnt; ++i) ans = ans * (i + 1) % mod;for (var i = 0; i < n - acnt; ++i) ans = ans * (i + 1) % mod;WriteLine(ans);}}