Submission #469291

#TimeUsernameProblemLanguageResultExecution timeMemory
469291sinamhdvSumtree (INOI20_sumtree)C++11
10 / 100
13 ms16044 KiB
#include <bits/stdc++.h>
using namespace std;

#define int ll

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod = 1000 * 1000 * 1000 + 7;
const int INF = 1e9 + 100;
const ll LINF = 1e18 + 100;

#ifdef DEBUG
#define dbg(x) cout << #x << " = " << (x) << endl << flush;
#define dbgr(s, f) { cout << #s << ": "; for (auto _ = (s); _ != (f); _++) cout << *_ << ' '; cout << endl << flush; }
#else
#define dbg(x) ;
#define dbgr(s, f) ;
#endif
#define fast_io ios::sync_with_stdio(0); cin.tie(0);
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fr first
#define sc second
#define endl '\n'

const int MAXN = 500100;

inline int poww(int a, int b)
{
	int res = 1;
	for (; b; a = (ll)a * a % mod, b /= 2) if (b & 1) res = (ll)res * a % mod;
	return res;
}

int n, rt, q;
vector<int> adj[MAXN];
int fact[MAXN];

inline int comb(int n, int k)
{
	return (fact[n] * (ll)poww(fact[k], mod - 2) % mod) * (ll)poww(fact[n - k], mod - 2) % mod;
}

int32_t main(void)
{
	fast_io;
	fact[0] = 1;
	cin >> n >> rt;
	FOR(i, 1, MAXN) fact[i] = fact[i - 1] * (ll)i % mod;
	cout << comb(n + rt - 1, n - 1) << endl;
	return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...