# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
935492 |
2024-02-29T08:04:05 Z |
PM1 |
Sumtree (INOI20_sumtree) |
C++17 |
|
86 ms |
9692 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxn=5e5+5,M=1e9+7;
int n,q,r;
ll fuck[mxn],rfuck[mxn];
ll ferma(ll x){
ll res=1,num=M-2;
while(num){
if(num&1)res=(res*x)%M;
x=(x*x)%M;
num/=2;
}
return res;
}
ll comb(ll x,ll y){
return (((fuck[y]*rfuck[x])%M)*rfuck[y-x])%M;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>r;
fuck[0]=1;
for(int i=1;i<mxn;i++){
fuck[i]=(fuck[i-1]*i)%M;
rfuck[i]=ferma(fuck[i]);
}
for(int i=1;i<=n-1;i++){
int x,y;
cin>>x>>y;
//v[x].push_back(y);
//v[y].push_back(x);
}
cout<<comb(n-1,n+r-1);
cin>>q;
while(q--){
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
9604 KB |
Output is correct |
2 |
Correct |
82 ms |
9552 KB |
Output is correct |
3 |
Correct |
82 ms |
9552 KB |
Output is correct |
4 |
Correct |
81 ms |
9552 KB |
Output is correct |
5 |
Correct |
82 ms |
9560 KB |
Output is correct |
6 |
Correct |
59 ms |
8276 KB |
Output is correct |
7 |
Correct |
58 ms |
8272 KB |
Output is correct |
8 |
Correct |
58 ms |
8068 KB |
Output is correct |
9 |
Correct |
83 ms |
9664 KB |
Output is correct |
10 |
Correct |
83 ms |
9608 KB |
Output is correct |
11 |
Correct |
82 ms |
9612 KB |
Output is correct |
12 |
Correct |
81 ms |
9484 KB |
Output is correct |
13 |
Correct |
86 ms |
9300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
8020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
82 ms |
9692 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
9436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
9604 KB |
Output is correct |
2 |
Correct |
82 ms |
9552 KB |
Output is correct |
3 |
Correct |
82 ms |
9552 KB |
Output is correct |
4 |
Correct |
81 ms |
9552 KB |
Output is correct |
5 |
Correct |
82 ms |
9560 KB |
Output is correct |
6 |
Correct |
59 ms |
8276 KB |
Output is correct |
7 |
Correct |
58 ms |
8272 KB |
Output is correct |
8 |
Correct |
58 ms |
8068 KB |
Output is correct |
9 |
Correct |
83 ms |
9664 KB |
Output is correct |
10 |
Correct |
83 ms |
9608 KB |
Output is correct |
11 |
Correct |
82 ms |
9612 KB |
Output is correct |
12 |
Correct |
81 ms |
9484 KB |
Output is correct |
13 |
Correct |
86 ms |
9300 KB |
Output is correct |
14 |
Incorrect |
58 ms |
8020 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |