QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#696031 | #7894. Many Many Heads | suzukaze_Aobayama (Takehiro Suda, Taishi Amagai, Yoshinori Furuto)# | Compile Error | / | / | C++20 | 1.2kb | 2024-10-31 21:20:53 | 2024-10-31 21:20:54 |
Judging History
This is the latest submission verdict.
- [2024-10-31 21:20:54]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-31 21:20:53]
- Submitted
answer
void solve(){
int n,k;
cin>>n>>k;
vvi edge(n);
rep(i,n-1){
int u,v;
cin>>u>>v;
u--;v--;
edge[u].push_back(v);
edge[v].push_back(u);
}
if(k<=-1){
auto dfs=[&](auto dfs,int v,int p)->vector<mint>{
vector<mint>dp(k+2,0);
dp[1]=1;
for(auto u:edge[v]){
if(u!=p){
dp=convolution(dp,dfs(dfs,u,v));
dp.resize(k+2);
}
}
dp[0]+=dp[k]+dp[k+1];
return dp;
};
vector<mint>dp=dfs(dfs,0,-1);
cout<<dp[0].val()<<'\n';
return;
}
else{
auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{
unordered_map<int,mint>dp;
dp[1]=1;
for(auto u:edge[v]){
if(u!=p){
auto dpu=dfs(dfs,u,v);
unordered_map<int,mint>ndp;
for(auto [k1,v1]:dp){
for(auto [k2,v2]:dpu){
if(k1+k2<=k+1)ndp[k1+k2]+=v1*v2;
}
}
dp=ndp;
}
}
if(dp.find(k)!=dp.end())dp[0]+=dp[k];
if(dp.find(k+1)!=dp.end()){
dp[0]+=dp[k+1];
}
return dp;
};
auto dp=dfs(dfs,0,-1);
cout<<dp[0].val()<<'\n';
}
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:3:3: error: ‘cin’ was not declared in this scope 3 | cin>>n>>k; | ^~~ answer.code:4:3: error: ‘vvi’ was not declared in this scope 4 | vvi edge(n); | ^~~ answer.code:5:7: error: ‘i’ was not declared in this scope 5 | rep(i,n-1){ | ^ answer.code:5:3: error: ‘rep’ was not declared in this scope 5 | rep(i,n-1){ | ^~~ answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:41: error: ‘vector’ does not name a type 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~~~ answer.code:14:47: error: expected ‘{’ before ‘<’ token 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^ answer.code:14:48: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^~~~ | int answer.code:14:53: error: expected primary-expression before ‘{’ token 14 | auto dfs=[&](auto dfs,int v,int p)->vector<mint>{ | ^ answer.code:26:5: error: ‘vector’ was not declared in this scope 26 | vector<mint>dp=dfs(dfs,0,-1); | ^~~~~~ answer.code:26:17: error: ‘dp’ was not declared in this scope 26 | vector<mint>dp=dfs(dfs,0,-1); | ^~ answer.code:27:5: error: ‘cout’ was not declared in this scope 27 | cout<<dp[0].val()<<'\n'; | ^~~~ answer.code:31:59: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 31 | auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{ | ^~~~ | int answer.code:31:59: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 31 | auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{ | ^~~~ | int answer.code:31:59: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 31 | auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{ | ^~~~ | int answer.code:31:59: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 31 | auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{ | ^~~~ | int answer.code:31:59: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 31 | auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{ | ^~~~ | int answer.code:31:59: error: ‘mint’ was not declared in this scope; did you mean ‘int’? 31 | auto dfs=[&](auto dfs,int v,int p)->unordered_map<int,mint>{ | ^~~~ | int...