# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101523 | rocketninja7 | Chase (CEOI17_chase) | C++14 | 124 ms | 10620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <vector>
using namespace std;
vector<int> adjList[100001];
long long int p[100001];
bool vis[100001];
long long int dp(int bread, int node){
if(bread==0){
return 0;
}
vis[node]=true;
long long int ans=0;
long long int temp=0;
for(int i=0;i<adjList[node].size();i++){
if(!vis[adjList[node][i]]){
temp+=p[adjList[node][i]];
}
}
for(int i=0;i<adjList[node].size();i++){
if(!vis[adjList[node][i]]){
ans=max(ans, max(dp(bread, adjList[node][i]), dp(bread-1, adjList[node][i])+temp));
}
}
return ans;
}
int main(){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |