結果

問題 No.2462 七人カノン
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-14 22:43:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 359 ms / 2,000 ms
コード長 1,183 bytes
コンパイル時間 1,862 ms
コンパイル使用メモリ 67,988 KB
実行使用メモリ 44,052 KB
最終ジャッジ日時 2023-09-14 22:43:29
合計ジャッジ時間 15,074 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
24,384 KB
testcase_01 AC 71 ms
24,336 KB
testcase_02 AC 72 ms
26,372 KB
testcase_03 AC 77 ms
24,396 KB
testcase_04 AC 75 ms
24,476 KB
testcase_05 AC 78 ms
26,396 KB
testcase_06 AC 76 ms
24,484 KB
testcase_07 AC 75 ms
26,416 KB
testcase_08 AC 76 ms
24,480 KB
testcase_09 AC 75 ms
26,444 KB
testcase_10 AC 77 ms
26,480 KB
testcase_11 AC 77 ms
24,388 KB
testcase_12 AC 75 ms
26,416 KB
testcase_13 AC 287 ms
42,356 KB
testcase_14 AC 294 ms
40,852 KB
testcase_15 AC 278 ms
40,208 KB
testcase_16 AC 308 ms
41,708 KB
testcase_17 AC 317 ms
39,648 KB
testcase_18 AC 114 ms
28,092 KB
testcase_19 AC 114 ms
28,056 KB
testcase_20 AC 334 ms
43,704 KB
testcase_21 AC 331 ms
39,604 KB
testcase_22 AC 332 ms
43,972 KB
testcase_23 AC 359 ms
43,712 KB
testcase_24 AC 231 ms
36,112 KB
testcase_25 AC 343 ms
44,052 KB
権限があれば一括ダウンロードができます

ソースコード

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[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, q) = (c[0], c[1]);
        var map = NArr(q);
        var num = new int[100_001];
        foreach (var que in map)
        {
            ++num[que[1]];
            --num[que[2]];
        }
        for (var i = 1; i < num.Length; ++i) num[i] += num[i - 1];
        var show = new double[num.Length + 1];
        for (var i = 0; i < num.Length; ++i)
        {
            if (num[i] > 0) show[i + 1] += 1.0 / num[i];
        }
        for (var i = 1; i < show.Length; ++i) show[i] += show[i - 1];
        var ans = new double[n];
        foreach (var que in map)
        {
            ans[que[0] - 1] += show[que[2]] - show[que[1]];
        }
        WriteLine(string.Join("\n", ans));
    }
}
0