結果

問題 No.2684 折々の色
ユーザー 👑 kakel-sankakel-san
提出日時 2024-03-20 23:14:39
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 3,100 bytes
コンパイル時間 7,036 ms
コンパイル使用メモリ 157,600 KB
実行使用メモリ 179,128 KB
最終ジャッジ日時 2024-03-20 23:15:12
合計ジャッジ時間 31,373 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
32,932 KB
testcase_01 AC 79 ms
32,676 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 78 ms
32,804 KB
testcase_05 AC 82 ms
32,676 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 83 ms
32,804 KB
testcase_09 WA -
testcase_10 AC 79 ms
32,804 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 146 ms
51,236 KB
testcase_22 AC 358 ms
66,008 KB
testcase_23 AC 321 ms
64,912 KB
testcase_24 AC 191 ms
61,436 KB
testcase_25 AC 243 ms
61,296 KB
testcase_26 AC 398 ms
67,728 KB
testcase_27 AC 288 ms
65,112 KB
testcase_28 AC 328 ms
64,912 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 721 ms
82,868 KB
testcase_39 AC 688 ms
82,868 KB
testcase_40 AC 713 ms
82,992 KB
testcase_41 AC 735 ms
82,992 KB
testcase_42 AC 708 ms
82,864 KB
testcase_43 AC 712 ms
82,864 KB
testcase_44 AC 684 ms
82,864 KB
testcase_45 AC 709 ms
82,996 KB
testcase_46 AC 690 ms
82,864 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 78 ms
32,932 KB
testcase_57 AC 78 ms
179,128 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (99 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

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

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, m) = (c[0], c[1]);
        var x = NList;
        var map = NArr(n);
        var dic = new Dictionary<long, List<int>>();
        for (var i = 0; i < n; ++i)
        {
            var nc = new long[m + 1];
            var flg = true;
            if (map[i][m] == 100)
            {
                for (var j = 0; j < m; ++j) if (x[j] != map[i][j]) flg = false;
                if (flg)
                {
                    WriteLine("Yes");
                    return;
                }
            }
            else
            {
                for (var j = 0; j < m; ++j)
                {
                    var ch = 10000L * x[j] - 100L * map[i][j] * map[i][m];
                    var pa = 100 - map[i][m];
                    if (ch < 0) flg = false;
                    if (ch % pa != 0) flg = false;
                    nc[j] = ch / pa;
                }
                nc[m] = 1;
                if (flg)
                {
                    var k = Key1(nc) * 1_000_000_007 + Key2(nc);
                    if (!dic.ContainsKey(k)) dic[k] = new List<int>();
                    dic[k].Add(i);
                }
            }
        }
        for (var i = 0; i < n; ++i)
        {
            var sk = Key1(map[i]) * 1_000_000_007 + Key2(map[i]);
            if (dic.ContainsKey(sk))
            {
                foreach (var btm in dic[sk])
                {
                    if (i == btm) continue;
                    for (var j = 0; j < m; ++j)
                    {
                        var flg = true;
                        if (10000L * x[j] != 100L * map[i][j] * map[i][m] + (100 - map[i][m]) * map[btm][j] * map[btm][m])
                        {
                            flg = false;
                        }
                        if (flg)
                        {
                            WriteLine("Yes");
                            return;
                        }
                    }
                }
            }
        }
        WriteLine("No");
    }
    static int mod1 = 998_244_397;
    static long Key1(long[] color)
    {
        var ans = 0L;
        for (var i = 0; i + 1 < color.Length; ++i)
        {
            ans = (ans * 13 % mod1 + color[i] * color[^1]) % mod1;
        }
        return ans;
    }
    static int mod2 = 998_244_391;
    static long Key2(long[] color)
    {
        var ans = 0L;
        for (var i = 0; i + 1 < color.Length; ++i)
        {
            ans = (ans * 17 % mod2 + (long)color[i] * color[^1]) % mod2;
        }
        return ans;
    }

}
 
0