# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293167 | AQT | Power Plant (JOI20_power) | C++14 | 200 ms | 26180 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 <bits/stdc++.h>
using namespace std;
int N;
vector<int> graph[200005];
int dp[200005];
string s;
int ans = 0;
void dfs(int n, int p){
int mx = 0;
for(int e : graph[n]){
if(e != p){
dfs(e, n);
dp[n] += dp[e];
mx = max(mx, dp[e]);
}
}
if(s[n-1] == '1'){
dp[n] = max(1, dp[n] - 1);
ans = max(ans, mx + 1);
}
ans = max(ans, dp[n]);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |