Submission #835776

# Submission time Handle Problem Language Result Execution time Memory
835776 2023-08-23T19:46:38 Z MohamedAliSaidane Sumtree (INOI20_sumtree) C++14
0 / 100
83 ms 30512 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[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();
}
# Verdict Execution time Memory Grader output
1 Runtime error 68 ms 29912 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 7368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 83 ms 30032 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 72 ms 30512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 68 ms 29912 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -