답안 #470179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470179 2021-09-03T07:44:16 Z radal Sumtree (INOI20_sumtree) C++14
10 / 100
163 ms 8196 KB
#include <bits/stdc++.h>
#define rep(i,l,r) for (int i = l; i < r; i++)
#define pb push_back
#define debug(x) cerr << #x <<  " : " << x << endl;
using namespace std;

typedef long long ll;

const ll N = 5e5+20,mod = 1e9+7;
int poww(int a,int k){
    if (!k) return 1;
    if (k == 1) return a;
    int r = poww(a,k/2);
    return 1ll*r*r%mod*poww(a,k&1)%mod;
}
ll fac[N],inv[N];
int main(){
    ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
    fac[0] = 1;
    inv[0] = 1;
    int n,r;
    cin >> n >> r;
    rep(i,1,n+r){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = poww(fac[i],mod-2);
    }
    cout << fac[r+n-1]*inv[n-1]%mod*inv[r]%mod;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 144 ms 7456 KB Output is correct
2 Correct 108 ms 5520 KB Output is correct
3 Correct 85 ms 4540 KB Output is correct
4 Correct 143 ms 7108 KB Output is correct
5 Correct 140 ms 7096 KB Output is correct
6 Correct 93 ms 4912 KB Output is correct
7 Correct 96 ms 5168 KB Output is correct
8 Correct 50 ms 2736 KB Output is correct
9 Correct 147 ms 7684 KB Output is correct
10 Correct 163 ms 8196 KB Output is correct
11 Correct 157 ms 8056 KB Output is correct
12 Correct 85 ms 4512 KB Output is correct
13 Correct 150 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 146 ms 7496 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 151 ms 7748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 144 ms 7456 KB Output is correct
2 Correct 108 ms 5520 KB Output is correct
3 Correct 85 ms 4540 KB Output is correct
4 Correct 143 ms 7108 KB Output is correct
5 Correct 140 ms 7096 KB Output is correct
6 Correct 93 ms 4912 KB Output is correct
7 Correct 96 ms 5168 KB Output is correct
8 Correct 50 ms 2736 KB Output is correct
9 Correct 147 ms 7684 KB Output is correct
10 Correct 163 ms 8196 KB Output is correct
11 Correct 157 ms 8056 KB Output is correct
12 Correct 85 ms 4512 KB Output is correct
13 Correct 150 ms 7248 KB Output is correct
14 Incorrect 1 ms 204 KB Output isn't correct
15 Halted 0 ms 0 KB -