結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー bluemeganebluemegane
提出日時 2023-08-05 07:46:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 114,664 KB
実行使用メモリ 40,672 KB
最終ジャッジ日時 2024-04-23 05:37:54
合計ジャッジ時間 2,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,840 KB
testcase_01 AC 25 ms
24,940 KB
testcase_02 AC 26 ms
26,748 KB
testcase_03 AC 50 ms
27,652 KB
testcase_04 AC 57 ms
30,700 KB
testcase_05 AC 38 ms
28,516 KB
testcase_06 AC 51 ms
29,720 KB
testcase_07 AC 79 ms
38,696 KB
testcase_08 AC 44 ms
27,200 KB
testcase_09 AC 29 ms
23,348 KB
testcase_10 AC 42 ms
25,140 KB
testcase_11 AC 89 ms
40,672 KB
testcase_12 AC 79 ms
37,320 KB
testcase_13 AC 31 ms
25,276 KB
testcase_14 AC 28 ms
24,936 KB
testcase_15 AC 30 ms
25,520 KB
testcase_16 AC 28 ms
25,196 KB
testcase_17 AC 31 ms
27,080 KB
testcase_18 AC 30 ms
27,132 KB
testcase_19 AC 30 ms
27,252 KB
testcase_20 AC 28 ms
25,184 KB
testcase_21 AC 28 ms
27,520 KB
testcase_22 AC 30 ms
25,292 KB
testcase_23 AC 32 ms
27,376 KB
testcase_24 AC 29 ms
27,540 KB
testcase_25 AC 29 ms
25,520 KB
testcase_26 AC 28 ms
27,240 KB
testcase_27 AC 29 ms
27,308 KB
testcase_28 AC 27 ms
24,628 KB
testcase_29 AC 29 ms
25,208 KB
testcase_30 AC 30 ms
27,360 KB
testcase_31 AC 30 ms
25,344 KB
testcase_32 AC 29 ms
25,196 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var an = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var bn = int.Parse(Console.ReadLine().Trim());
        line = Console.ReadLine().Trim().Split(' ');
        var b = Array.ConvertAll(line, int.Parse);
        getAns(n, an, a, bn, b);
    }
    static void calc(int n, int aL, int[] a, bool[] c)
    {
        var p = 0;
        c[p] = true;
        for (int i = 0; i < aL; i++)
        {
            p += a[i];
            c[p] = true;
        }
    }
    static void getAns(int n, int an, int[] a, int bn, int[] b)
    {
        var c = new bool[n + 1];
        calc(n, an, a, c);
        Array.Reverse(b);
        calc(n, bn, b, c);
        var ans = c.Count(x => x == false);
        Console.WriteLine(ans);
    }
}
0