Submission #999047

#TimeUsernameProblemLanguageResultExecution timeMemory
999047vjudge1Sumtree (INOI20_sumtree)C++17
10 / 100
45 ms4376 KiB
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9+7; const int N = 5e5+10; long long fact[N]; long long binpow(long long a, long long b) { long long ans = 1; while(b) { if(b&1) { ans=(ans*a)%mod; } a=(a*a)%mod; b>>=1; } return ans; } long long ncr(long long nn, long long rr) { if(rr > nn)return 0; long long ans = fact[nn]; ans = (ans*binpow(fact[rr], mod-2))%mod; ans = (ans*binpow(fact[nn-rr], mod-2))%mod; return ans; } int main () { cin.tie(0)->sync_with_stdio(0); fact[0] = 1; for(int i = 1;i<N;i++)fact[i] = (fact[i-1]*i)%mod; int n, r; cin >> n >> r; int q; while(cin >> q); cout << ncr(n+r-1, r) << "\n"; }
#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...