結果

問題 No.2008 Super Worker
ユーザー 👑 kakel-sankakel-san
提出日時 2022-08-28 23:28:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 993 bytes
コンパイル時間 2,623 ms
コンパイル使用メモリ 107,008 KB
実行使用メモリ 50,476 KB
最終ジャッジ日時 2024-04-23 19:04:45
合計ジャッジ時間 7,201 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
18,944 KB
testcase_01 AC 24 ms
19,072 KB
testcase_02 AC 25 ms
19,072 KB
testcase_03 AC 24 ms
19,072 KB
testcase_04 AC 25 ms
18,944 KB
testcase_05 AC 25 ms
18,944 KB
testcase_06 AC 25 ms
19,200 KB
testcase_07 AC 26 ms
18,944 KB
testcase_08 AC 24 ms
18,816 KB
testcase_09 AC 25 ms
19,072 KB
testcase_10 AC 25 ms
18,816 KB
testcase_11 AC 24 ms
19,328 KB
testcase_12 AC 25 ms
19,072 KB
testcase_13 AC 30 ms
19,584 KB
testcase_14 AC 30 ms
19,456 KB
testcase_15 AC 29 ms
19,712 KB
testcase_16 AC 29 ms
19,840 KB
testcase_17 AC 29 ms
19,456 KB
testcase_18 AC 30 ms
19,840 KB
testcase_19 AC 30 ms
19,584 KB
testcase_20 AC 30 ms
19,840 KB
testcase_21 AC 29 ms
19,968 KB
testcase_22 AC 28 ms
19,456 KB
testcase_23 AC 217 ms
48,512 KB
testcase_24 AC 214 ms
48,512 KB
testcase_25 AC 211 ms
48,256 KB
testcase_26 AC 219 ms
48,000 KB
testcase_27 AC 231 ms
48,384 KB
testcase_28 AC 236 ms
49,752 KB
testcase_29 AC 240 ms
49,772 KB
testcase_30 AC 238 ms
49,636 KB
testcase_31 AC 238 ms
49,768 KB
testcase_32 AC 249 ms
49,896 KB
testcase_33 AC 213 ms
50,476 KB
testcase_34 AC 236 ms
49,692 KB
testcase_35 AC 184 ms
42,496 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 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 void Main()
    {
        var n = NN;
        var a = NList;
        var b = NList;
        WriteLine(Work(n, a, b));
    }
    static long Work(int n, int[] a, int[] b)
    {
        var p = new List<int>();
        for (var i = 0; i < n; ++i) p.Add(i);
        p.Sort((l, r) =>
        {
            var d = (long)a[l] * (1 - b[r]) - (long)a[r] * (1 - b[l]);
            if (d > 0) return -1;
            else if (d < 0) return 1;
            else return 0;
        });
        var mod = 1_000_000_007;
        var res = 0L;
        var lv = 1L;
        foreach (var pi in p)
        {
            res = (res + lv * a[pi] % mod) % mod;
            lv = lv * b[pi] % mod;
        }
        return (res);
    }
}
0