222332026-01-14 18:18:24TaxiradioJáték (50 pont)cpp17Accepted 50/508ms2600 KiB
#include <bits/stdc++.h>
using namespace std;

#define int int64_t

int p(int a , int b , int m){
	int x = 1;
	for(int i = 0; i < 30; i++){
		if((1<<i)&b){
			x*=a;
			x%=m;
		}
		a*=a;
		a%=m;
	}
	return x;
}

int M = 1e9+7;

vector<int> f;

int32_t main() {
	int b , c;cin >> b >> c;
	f.push_back(1);
	for(int i = 1; i <= 2*c; i++){
		f.push_back((f.back()*i)%M);
	}
	int d = (f[c-1+c-b]*p((f[c-1]*f[c-b])%M , M-2 , M))%M;
	int e = (f[c-1+c-b]*p((f[c]*f[c-b-1])%M , M-2 , M))%M;
	cout << (d-e+M*3)%M << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted3/31ms564 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms400 KiB
9Accepted3/32ms556 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms568 KiB
12Accepted3/32ms624 KiB
13Accepted3/32ms988 KiB
14Accepted3/37ms2468 KiB
15Accepted3/34ms1452 KiB
16Accepted3/38ms2468 KiB
17Accepted3/34ms1452 KiB
18Accepted3/37ms2600 KiB
19Accepted3/38ms2544 KiB