結果

問題 No.2784 繰り上がりなし十進和
ユーザー 👑 kakel-sankakel-san
提出日時 2024-06-23 22:14:43
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 1,605 ms / 2,000 ms
コード長 1,617 bytes
コンパイル時間 14,592 ms
コンパイル使用メモリ 169,560 KB
実行使用メモリ 321,224 KB
最終ジャッジ日時 2024-06-23 22:15:44
合計ジャッジ時間 60,369 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,039 ms
165,440 KB
testcase_01 AC 1,048 ms
165,516 KB
testcase_02 AC 1,319 ms
166,800 KB
testcase_03 AC 1,053 ms
165,392 KB
testcase_04 AC 1,057 ms
165,384 KB
testcase_05 AC 1,025 ms
165,400 KB
testcase_06 AC 1,052 ms
165,480 KB
testcase_07 AC 1,049 ms
165,348 KB
testcase_08 AC 1,053 ms
165,392 KB
testcase_09 AC 1,044 ms
165,640 KB
testcase_10 AC 1,052 ms
165,352 KB
testcase_11 AC 1,023 ms
165,268 KB
testcase_12 AC 1,413 ms
166,832 KB
testcase_13 AC 1,298 ms
167,088 KB
testcase_14 AC 1,139 ms
166,536 KB
testcase_15 AC 1,035 ms
166,068 KB
testcase_16 AC 1,095 ms
166,412 KB
testcase_17 AC 1,356 ms
166,968 KB
testcase_18 AC 1,299 ms
166,928 KB
testcase_19 AC 1,110 ms
166,420 KB
testcase_20 AC 1,535 ms
166,964 KB
testcase_21 AC 1,075 ms
166,416 KB
testcase_22 AC 1,531 ms
166,672 KB
testcase_23 AC 1,060 ms
166,288 KB
testcase_24 AC 1,126 ms
166,588 KB
testcase_25 AC 1,294 ms
166,420 KB
testcase_26 AC 1,605 ms
166,792 KB
testcase_27 AC 1,581 ms
166,796 KB
testcase_28 AC 1,175 ms
166,704 KB
testcase_29 AC 1,589 ms
167,020 KB
testcase_30 AC 1,191 ms
166,420 KB
testcase_31 AC 1,107 ms
166,504 KB
testcase_32 AC 1,299 ms
166,920 KB
testcase_33 AC 1,271 ms
166,636 KB
testcase_34 AC 1,156 ms
166,540 KB
testcase_35 AC 1,083 ms
321,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (92 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/

ソースコード

diff #

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[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(ReadLine())).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var a = LList(6);
        var tree = new List<int>[1000000];
        for (var i = 0; i < tree.Length; ++i) tree[i] = new List<int>();
        for (var i = 0; i < 6; ++i)
        {
            for (var j = 0; j < tree.Length; ++j)
            {
                tree[j].Add(Add(a[i], j));
            }
        }
        var visited = new bool[tree.Length];
        visited[a[0]] = true;
        var q = new Queue<int>();
        q.Enqueue(a[0]);
        while (q.Count > 0)
        {
            var cur = q.Dequeue();
            foreach (var next in tree[cur])
            {
                if (visited[next]) continue;
                visited[next] = true;
                q.Enqueue(next);
            }
        }
        WriteLine(visited.Count(f => f));
    }
    static int Add(int a, int b)
    {
        return (a / 100000 + b / 100000) % 10 * 100000
            + (a / 10000 % 10 + b / 10000 % 10) % 10 * 10000
            + (a / 1000 % 10 + b / 1000 % 10) % 10 * 1000
            + (a / 100 % 10 + b / 100 % 10) % 10 * 100
            + (a / 10 % 10 + b / 10 % 10) % 10 * 10
            + (a % 10 + b % 10) % 10;
    }
}
0