Submission #999047

# Submission time Handle Problem Language Result Execution time Memory
999047 2024-06-15T05:38:03 Z vjudge1 Sumtree (INOI20_sumtree) C++17
10 / 100
45 ms 4376 KB
#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 time Memory Grader output
1 Correct 24 ms 4188 KB Output is correct
2 Correct 24 ms 4368 KB Output is correct
3 Correct 23 ms 4184 KB Output is correct
4 Correct 24 ms 4184 KB Output is correct
5 Correct 23 ms 4188 KB Output is correct
6 Correct 4 ms 4188 KB Output is correct
7 Correct 3 ms 4188 KB Output is correct
8 Correct 4 ms 4188 KB Output is correct
9 Correct 24 ms 4376 KB Output is correct
10 Correct 24 ms 4188 KB Output is correct
11 Correct 24 ms 4188 KB Output is correct
12 Correct 23 ms 4188 KB Output is correct
13 Correct 27 ms 4184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 4188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 4188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 4188 KB Output is correct
2 Correct 24 ms 4368 KB Output is correct
3 Correct 23 ms 4184 KB Output is correct
4 Correct 24 ms 4184 KB Output is correct
5 Correct 23 ms 4188 KB Output is correct
6 Correct 4 ms 4188 KB Output is correct
7 Correct 3 ms 4188 KB Output is correct
8 Correct 4 ms 4188 KB Output is correct
9 Correct 24 ms 4376 KB Output is correct
10 Correct 24 ms 4188 KB Output is correct
11 Correct 24 ms 4188 KB Output is correct
12 Correct 23 ms 4188 KB Output is correct
13 Correct 27 ms 4184 KB Output is correct
14 Incorrect 3 ms 4188 KB Output isn't correct
15 Halted 0 ms 0 KB -