結果

問題 No.2462 七人カノン
ユーザー kw_ckw_c
提出日時 2023-09-16 00:33:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 4,307 bytes
コンパイル時間 2,412 ms
コンパイル使用メモリ 207,340 KB
実行使用メモリ 5,772 KB
最終ジャッジ日時 2023-09-16 00:34:09
合計ジャッジ時間 6,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 RE -
testcase_02 AC 1 ms
4,376 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = n-1; i >= (0); --i)
#define IO ios::sync_with_stdio(0),cin.tie(0);
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define bpop(x) __builtin_popcount(x)
#define bpopll(x) __builtin_popcountll(x)


template<class T>
bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template<class T>
bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
void print_imp() {}
template<class First, class... Rest>
void print_imp(First f, Rest... r) { cout<<f; if (sizeof...(r)) cout<<" "; print_imp(r...); }
template<class... Args>
void print(Args... args) { print_imp(args...); cout << endl; }
template<class T>
void print_pair(vector<T> &v) { for (auto [a,b] : v) print(a, b); }
template<class T>
void print_vec(vector<T> &v) { rep(i, v.size()) {cout << v[i]; if (i == v.size()-1) cout << endl; else cout << " ";} }
template<class T>
void print_mat(vector<vector<T>> &m) { for (auto v : m) print_vec(v); }
template<class T>
void print_bit(T s, int n) { rep(i, n) {if (s>>i&1) cout<<1; else cout<<0;} cout<<endl; }
void print_double(double x) { cout << fixed << setprecision(15) << x << endl; }

template<class T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;
template<class T>
using vt = vector<T>;
template<class T>
using vvt = vt<vt<T>>;
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

const ll MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 4e18;
const double PI = 3.14159265358979323846;

/*
- comb                          modintのnCk,nPk,nHk
- matrix                        行列累乗
- Mo                            Mo's algorithm
- segtree_min/max               segtree 点更新
- RMQ/RMAQ_min/max              lazy_segtree 区間加算/変更、区間最小値/最大値取得
- RSQ/RSAQ                      lazy_segtree 区間加算/変更、区間和取得
- Eratosthenes                  高速素因数分解可能なエラトステネスのふるい
- Factorize                     素因数分解 計算量: O(sqrt(x)) 
- dydx, dydx8                   dy,dx={右,下,左,上}
- grid_continue                 if (i < 0 || j < 0 || i >= h || j >= w) continue;
- Pascal                        パスカルの三角形
- Graph                         グラフ関連のライブラリ
    - dijkstra                  ダイクストラ法
    - bellman_ford              ベルマンフォード、負のサイクル検出
    - topological_sort          トポロジカルソート
    - find_cycle_directed       有向グラフのサイクル検出
    - bfs01                     01-BFS
    - tree_diameter             木の直径
    - euler_tour                オイラーツアー
    - build_LCA, get_LCA        LCA
    - build_tree_dist           木の根からの距離
    - dfs_temp                  DFSのためのテンプレート

    - init_tree_from_parents    親頂点配列でGraph初期化
    - init_graph_from_grid      グリッド文字列からGraph初期化
*/

void solve() {
    int n, q;
    cin >> n >> q;
    /* const int lim = 1e5+10; */
    const int lim = 20;
    vt<int> A(lim);
    vt<int> D(lim);
    vt<double> S(lim);
    vvt<pii> I(n);
    rep(_, q) {
        int i, s, t;
        cin >> i >> s >> t;
        i--;
        D[s]++;
        D[t]--;
        I[i].eb(s, t);
    }
    rep(i, lim) {
        D[i+1] += D[i];
    }
    /* cout << "D:"; */
    /* print_vec(D); */
    rep(i, lim) {
        if (D[i] == 0) continue;
        S[i] = 1. / D[i];
    }
    /* cout << "before S:"; */
    /* print_vec(S); */

    rep(i, lim) {
        S[i+1] += S[i];
    }
    /* cout << "S:"; */
    /* print_vec(S); */
    rep(i, n) {
        double now = 0;
        for (auto [s, t] : I[i]) {
            now += S[t-1];
            if (s-1 >= 0) now -= S[s-1];
        }
        print_double(now);
    }
}

int main() {
    IO
    /* int t; cin >> t; rep(_, t) solve(); */
    solve();
    return 0;
}
0