[Codeforces 903 D. Almost Difference]树状数组+大数模板

[Codeforces 903 D. Almost Difference]树状数组+大数模板

分类:FenwickTree BigInteger template

1. 题目链接

[Codeforces 903 D. Almost Difference]

2. 题意描述

题意描述

3. 解题思路

思路很简单,首先,对每个数进行离散化。树状数组维护每个数出现的次数,以及区间和。
但是,这题最终的答案会达到 1019 以上, 64bit long long 存不下来。
然后,从cf上扒下了一个比较完美的大数模板。=_=!
cf竟然不支持__int128

4. 实现代码

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double lb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ull, ull> puu;
typedef pair<lb, lb> pbb;

const int inf = 0x3f3f3f3f;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
template<typename T> inline void umax(T &a, T b) { a = max(a, b); }
template<typename T> inline void umin(T &a, T b) { a = min(a, b); }
template<typename T> inline T randIntv(const T& a, const T& b) { return (T)rand() % (b - a + 1) + a; }
void debug() { cout << endl; }
template<typename T, typename ...R> void debug (T f, R ...r) { cout << "[" << f << "]"; debug (r...); }

const int base = 1000000000;
const int base_digits = 9;

struct bigint {
    vector<int> z;
    int sign;

    bigint() : sign(1) { }

    bigint(long long v) { *
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值