# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131412 | 2019-07-17T06:41:28 Z | Mahdi_Jfri | Friend (IOI14_friend) | C++14 | 3 ms | 380 KB |
#include "friend.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 1e3 + 20; vector<int> adj[maxn] , adj2[maxn]; int dp[maxn][2] , a[maxn]; bool is[maxn]; void plant(int v) { dp[v][1] = a[v]; for(auto u : adj[v]) { plant(u); dp[v][0] += dp[u][1]; dp[v][1] += dp[u][0]; } dp[v][1] = max(dp[v][1] , dp[v][0]); } int findSample(int n,int a[],int host[],int pt[]) { bool has[3] = {0 , 0 , 0}; for(int i = 1; i < n; i++) { has[pt[i]] = 1; if(pt[i] == 0) adj[host[i]].pb(i); else adj2[host[i]].pb(i); is[i] = (pt[i] == 2); } pt[0] = 1; for(int i = 0; i < n; i++) if(!i || pt[i]) plant(i); return dp[0][1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |