結果

問題 No.989 N×Mマス計算(K以上)
ユーザー bluemeganebluemegane
提出日時 2020-02-15 14:12:11
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,430 bytes
コンパイル時間 915 ms
コンパイル使用メモリ 111,532 KB
実行使用メモリ 38,216 KB
最終ジャッジ日時 2024-04-16 03:10:15
合計ジャッジ時間 2,884 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,172 KB
testcase_01 AC 29 ms
26,084 KB
testcase_02 AC 29 ms
24,048 KB
testcase_03 AC 29 ms
24,172 KB
testcase_04 AC 28 ms
24,052 KB
testcase_05 AC 29 ms
26,340 KB
testcase_06 AC 29 ms
24,168 KB
testcase_07 AC 29 ms
24,304 KB
testcase_08 AC 30 ms
24,160 KB
testcase_09 AC 29 ms
23,924 KB
testcase_10 AC 91 ms
28,452 KB
testcase_11 AC 88 ms
31,944 KB
testcase_12 WA -
testcase_13 AC 63 ms
28,444 KB
testcase_14 WA -
testcase_15 AC 58 ms
25,396 KB
testcase_16 AC 81 ms
30,648 KB
testcase_17 AC 62 ms
28,548 KB
testcase_18 AC 70 ms
26,984 KB
testcase_19 AC 85 ms
32,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var k = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var op = line[0];
        var a = new long[m];
        for (int i = 0; i < m; i++) a[i] = long.Parse(line[i + 1]);
        var b = new int[n];
        for (int i = 0; i < n; i++) b[i] = int.Parse(Console.ReadLine().Trim());
        Array.Sort(b);
        var ans = 0;
        for (int i = 0; i < m; i++)
        {
            long t;
            if (op == "+") t = k - a[i];
            else t = (a[i] + k - 1) / a[i];
            var w = LowerBound(b, (int)t);
            ans += n - w;
        }
        Console.WriteLine(ans);

    }
    public static int LowerBound<T>(T[] arr, int start, int end, T value, IComparer<T> comparer)
    {
        int low = start;
        int high = end;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (comparer.Compare(arr[mid], value) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int LowerBound<T>(T[] arr, T value) where T : IComparable =>
                                   LowerBound(arr, 0, arr.Length, value, Comparer<T>.Default);
}

0