結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー |
|
提出日時 | 2023-08-02 23:17:52 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 372 ms / 2,000 ms |
コード長 | 2,347 bytes |
コンパイル時間 | 911 ms |
コンパイル使用メモリ | 108,160 KB |
実行使用メモリ | 53,992 KB |
最終ジャッジ日時 | 2024-10-12 21:37:30 |
合計ジャッジ時間 | 35,721 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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(); static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray(); public static void Main() { Solve(); } static void Solve() { var t = NN; var ans = new List<string>(); for (var u = 0; u < t; ++u) { var c = NList; var (n, m) = (c[0], c[1]); var a = new int[n]; var b = new int[n]; if (n > 0) a = NList; else ReadLine(); if (m > 0) b = NList; else ReadLine(); var bset = new HashSet<int>(b); var eq = new HashSet<int>(); foreach (var ai in a) if (bset.Contains(ai)) eq.Add(ai); if (n == 0) { ans.Add("Yes"); foreach (var bi in b) ans.Add("Blue " + bi); } else if (m == 0) { ans.Add("Yes"); foreach (var ai in a) ans.Add("Red " + ai); } else if (eq.Count == 0) { ans.Add("No"); } else { ans.Add("Yes"); foreach (var ai in a) if (!eq.Contains(ai)) ans.Add("Red " + ai); var tmp = 0; foreach (var ai in eq) { if (tmp % 2 == 0) { ans.Add("Red " + ai); ans.Add("Blue " + ai); } else { ans.Add("Blue " + ai); ans.Add("Red " + ai); } if (tmp == 0) { foreach (var bi in b) if (!eq.Contains(bi)) ans.Add("Blue " + bi); } ++tmp; } } } WriteLine(string.Join("\n", ans)); } }