結果

問題 No.2462 七人カノン
ユーザー 👑 chro_96chro_96
提出日時 2023-09-08 21:45:23
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 1,166 ms
コンパイル使用メモリ 28,908 KB
実行使用メモリ 5,088 KB
最終ジャッジ日時 2023-09-08 21:45:33
合計ジャッジ時間 8,897 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,012 KB
testcase_01 AC 2 ms
5,088 KB
testcase_02 AC 2 ms
5,052 KB
testcase_03 AC 4 ms
4,952 KB
testcase_04 AC 4 ms
5,008 KB
testcase_05 AC 4 ms
4,952 KB
testcase_06 AC 4 ms
5,040 KB
testcase_07 AC 4 ms
4,956 KB
testcase_08 AC 4 ms
4,992 KB
testcase_09 AC 3 ms
5,004 KB
testcase_10 AC 3 ms
5,056 KB
testcase_11 AC 4 ms
5,048 KB
testcase_12 AC 3 ms
4,900 KB
testcase_13 AC 65 ms
5,056 KB
testcase_14 AC 72 ms
4,948 KB
testcase_15 AC 67 ms
5,004 KB
testcase_16 AC 77 ms
4,992 KB
testcase_17 AC 77 ms
4,952 KB
testcase_18 AC 40 ms
5,012 KB
testcase_19 AC 41 ms
5,036 KB
testcase_20 AC 71 ms
4,992 KB
testcase_21 AC 73 ms
5,056 KB
testcase_22 AC 75 ms
4,992 KB
testcase_23 AC 71 ms
5,044 KB
testcase_24 AC 60 ms
5,056 KB
testcase_25 AC 79 ms
5,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int n = 0;
  int q = 0;
  int ist[100000][3] = {};
  
  int res = 0;
  
  double ans[100000] = {};
  int cnt[100001] = {};
  double sum[100001] = {};
  
  res = scanf("%d", &n);
  res = scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    res = scanf("%d", ist[i]);
    res = scanf("%d", ist[i]+1);
    res = scanf("%d", ist[i]+2);
    ist[i][0]--;
    cnt[ist[i][1]]++;
    cnt[ist[i][2]]--;
  }
  
  for (int i = 0; i < 100000; i++) {
    if (cnt[i] > 0) {
      sum[i+1] = sum[i]+1.0/((double)cnt[i]);
    }
    cnt[i+1] += cnt[i];
  }
  
  for (int i = 0; i < q; i++) {
    ans[ist[i][0]] += sum[ist[i][2]]-sum[ist[i][1]];
  }
  
  for (int i = 0; i < n; i++) {
    printf("%.16lf\n", ans[i]);
  }
  
  return 0;
}
0