답안 #835777

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
835777 2023-08-23T19:47:13 Z MohamedAliSaidane Sumtree (INOI20_sumtree) C++14
0 / 100
72 ms 14500 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()


ll MOD = 1e9 + 7;
ll mod(ll x, ll m = MOD){return (x + m)%m;}
const int nax= 2e5 + 5;
const int rax= 3e5 + 5;
ll fact[2 * rax];
ll binpow(ll a, ll b, ll m= MOD)
{
    ll res = 1ll;
    while(b)
    {
        if(b & 1)
            res = mod(res * 1ll * a);
        a = mod(a * 1ll * a);
        b /= 2ll;
    }
    return res;
}
ll inv(ll x, ll m = MOD)
{
    return binpow(x, m - 2ll, m);
}
ll C(int a, int b)
{
    return mod(fact[a] * inv(mod(fact[a - b] * fact[b])));
}
ll formula(int s, int k)
{
    return C(s + k, k);
}

int n, r;
vector<int> adj[nax];

void solve()
{
    cin >> n >> r;
    for(int i =1; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    cout << formula(r, n - 1);
    int q; cin >> q;
    while(q--)
    {
        int t; cin >> t;
        if(t == 1)
        {

        }
        else
        {

        }
    }
}
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    fact[0] = 1ll;
    for(int i = 1; i < rax; i++)
        fact[i] = mod(fact[i - 1] * 1ll * i);
    int tt = 1;
    while(tt--)
        solve();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 13592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 7252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 67 ms 13660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 72 ms 14500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 13592 KB Output isn't correct
2 Halted 0 ms 0 KB -