結果

問題 No.3196 Unique Nickname
コンテスト
ユーザー kakel-san
提出日時 2025-07-11 22:45:14
言語 C#
(.NET 10.0.201)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 35 ms / 2,000 ms
+ 828µs
コード長 1,007 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,775 ms
コンパイル使用メモリ 172,824 KB
実行使用メモリ 193,912 KB
最終ジャッジ日時 2026-07-13 04:03:48
合計ジャッジ時間 12,497 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (92 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static string[] NList => ReadLine().Split().ToArray();
    static string[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var arr = NArr(n);
        for (var i = 0; i < n; ++i)
        {
            var s = true;
            var t = true;
            for (var j = 0; j < n; ++j)
            {
                if (i == j) continue;
                if (arr[i][0] == arr[j][0] || arr[i][0] == arr[j][1]) s = false;
                if (arr[i][1] == arr[j][0] || arr[i][1] == arr[j][1]) t = false;
            }
            if (!s && !t)
            {
                WriteLine("No");
                return;
            }
        }
        WriteLine("Yes");
    }
}
0