結果

問題 No.2462 七人カノン
ユーザー tnakao0123tnakao0123
提出日時 2023-09-11 16:04:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 41,332 KB
実行使用メモリ 6,176 KB
最終ジャッジ日時 2023-09-11 16:05:07
合計ジャッジ時間 10,142 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 3 ms
4,384 KB
testcase_02 AC 3 ms
4,384 KB
testcase_03 AC 4 ms
4,384 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 4 ms
4,384 KB
testcase_11 AC 3 ms
4,384 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 61 ms
5,992 KB
testcase_14 AC 67 ms
6,088 KB
testcase_15 AC 61 ms
5,916 KB
testcase_16 AC 70 ms
6,100 KB
testcase_17 AC 70 ms
6,108 KB
testcase_18 AC 38 ms
4,388 KB
testcase_19 AC 38 ms
4,384 KB
testcase_20 AC 65 ms
6,104 KB
testcase_21 AC 64 ms
6,076 KB
testcase_22 AC 67 ms
6,168 KB
testcase_23 AC 66 ms
6,096 KB
testcase_24 AC 56 ms
5,528 KB
testcase_25 AC 72 ms
6,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2462.cc:  No.2462 七人カノン - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_QN = 100000;
const int MAX_T = 100000;

/* typedef */

/* global variables */

int is[MAX_QN], ss[MAX_QN], ts[MAX_QN];
int cs[MAX_T + 1];
double ess[MAX_T + 1], fs[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, qn;
  scanf("%d%d", &n, &qn);
  for (int i = 0; i < qn; i++)
    scanf("%d%d%d", is + i, ss + i, ts + i), is[i]--;

  for (int i = 0; i < qn; i++) cs[ss[i]]++, cs[ts[i]]--;

  for (int t = 0; t < MAX_T; t++) {
    ess[t + 1] = ess[t] + (cs[t] > 0 ? 1.0 / cs[t] : 0.0);
    cs[t + 1] += cs[t];
  }

  for (int i = 0; i < qn; i++)
    fs[is[i]] += ess[ts[i]] - ess[ss[i]];
  
  for (int i = 0; i < n; i++) printf("%.14lf\n", fs[i]);

  return 0;
}
0