Submission #835776

#TimeUsernameProblemLanguageResultExecution timeMemory
835776MohamedAliSaidaneSumtree (INOI20_sumtree)C++14
0 / 100
83 ms30512 KiB
#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 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...