結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー tsushimatsushima
提出日時 2019-11-30 10:05:55
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,402 bytes
コンパイル時間 6,311 ms
コンパイル使用メモリ 113,508 KB
実行使用メモリ 30,172 KB
最終ジャッジ日時 2024-05-01 01:46:28
合計ジャッジ時間 8,399 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 75 ms
25,972 KB
testcase_02 AC 42 ms
25,648 KB
testcase_03 AC 79 ms
25,952 KB
testcase_04 AC 86 ms
27,772 KB
testcase_05 AC 45 ms
27,948 KB
testcase_06 AC 115 ms
26,288 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 35 ms
25,520 KB
testcase_13 AC 34 ms
23,088 KB
testcase_14 AC 36 ms
25,396 KB
testcase_15 AC 35 ms
27,184 KB
testcase_16 AC 34 ms
23,352 KB
testcase_17 AC 225 ms
26,292 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
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 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
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 WA -
testcase_57 WA -
testcase_58 AC 34 ms
25,556 KB
testcase_59 AC 35 ms
25,652 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            var A = Console.ReadLine().Split().Select(int.Parse).OrderBy(z => z).ToArray();
            var Q = int.Parse(Console.ReadLine());
            var K = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var acum = new long[N + 1];
            var count = new int[N + 1];

            for (var i = 0; i < N; i++)
            {
                acum[i + 1] = acum[i] + A[i];
                count[i + 1] = count[i] + (S[i] == 'E' ? 1 : 0);
            }

            for (var i = 0; i < Q; i++)
            {
                var ans = 0;
                for (var j = 0; j <= N; j++)
                {
                    var ok = j;
                    var ng = N + 1;

                    while (ng - ok > 1)
                    {
                        var med = (ng + ok) / 2;
                        if (acum[med] - acum[j] <= K[i])
                            ok = med;
                        else
                            ng = med;
                    }

                    ans = Math.Max(ans, count[ok] - count[j]);
                }

                Console.WriteLine(ans);
            }
        }
    }
}
0