답안 #469291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
469291 2021-08-31T11:08:10 Z sinamhdv Sumtree (INOI20_sumtree) C++11
10 / 100
13 ms 16044 KB
#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;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 15948 KB Output is correct
2 Correct 13 ms 15948 KB Output is correct
3 Correct 12 ms 15948 KB Output is correct
4 Correct 13 ms 15948 KB Output is correct
5 Correct 12 ms 15940 KB Output is correct
6 Correct 13 ms 15916 KB Output is correct
7 Correct 12 ms 15920 KB Output is correct
8 Correct 12 ms 15992 KB Output is correct
9 Correct 12 ms 15948 KB Output is correct
10 Correct 13 ms 15948 KB Output is correct
11 Correct 13 ms 15920 KB Output is correct
12 Correct 13 ms 16044 KB Output is correct
13 Correct 12 ms 16020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 15948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 15948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 15948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 15948 KB Output is correct
2 Correct 13 ms 15948 KB Output is correct
3 Correct 12 ms 15948 KB Output is correct
4 Correct 13 ms 15948 KB Output is correct
5 Correct 12 ms 15940 KB Output is correct
6 Correct 13 ms 15916 KB Output is correct
7 Correct 12 ms 15920 KB Output is correct
8 Correct 12 ms 15992 KB Output is correct
9 Correct 12 ms 15948 KB Output is correct
10 Correct 13 ms 15948 KB Output is correct
11 Correct 13 ms 15920 KB Output is correct
12 Correct 13 ms 16044 KB Output is correct
13 Correct 12 ms 16020 KB Output is correct
14 Incorrect 12 ms 15948 KB Output isn't correct
15 Halted 0 ms 0 KB -