結果

問題 No.3041 非対称じゃんけん
ユーザー kakel-san
提出日時 2025-02-28 22:42:01
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 1,783 bytes
コンパイル時間 8,823 ms
コンパイル使用メモリ 170,604 KB
実行使用メモリ 353,912 KB
最終ジャッジ日時 2025-02-28 22:42:26
合計ジャッジ時間 22,250 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 25 TLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (121 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

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

class Program
{
    static long NN => long.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 p = NList;
        var (n, f) = (p[0], p[1]);
        var a = NList;
        var b = NList;
        var c = NList;
        var ans = new int[n];
        var dp = new bool[n * f + 1];
        dp[0] = true;
        var move = new HashSet<int>[f + 1];
        move[0] = new HashSet<int>();
        for (var i = 0; i < move.Length; ++i) move[i] = new HashSet<int>{ 0 };
        for (var i = 0; i < n; ++i)
        {
            var add = new HashSet<int>();
            foreach (var cur in move[a[i]]) if (!dp[cur + a[i]])
            {
                dp[cur + a[i]] = true;
                add.Add(cur + a[i]);
            }
            move[a[i]] = new HashSet<int>();
            foreach (var cur in move[b[i]]) if (!dp[cur + b[i]])
            {
                dp[cur + b[i]] = true;
                add.Add(cur + b[i]);
            }
            move[b[i]] = new HashSet<int>();
            foreach (var cur in move[c[i]]) if (!dp[cur + c[i]])
            {
                dp[cur + c[i]] = true;
                add.Add(cur + c[i]);
            }
            foreach (var ai in add) for (var j = 1; j < move.Length; ++j) move[j].Add(ai);
            if (i == 0) ans[0] = add.Count + 1;
            else ans[i] = ans[i - 1] + add.Count;
        }
        WriteLine(string.Join("\n", ans));
    }
}
0