# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
321074 | forza_viola | Dostavljač (COCI18_dostavljac) | C++14 | 243 ms | 3392 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 <GOD>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define len length
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define frei freopen("input.txt","r",stdin)
#define freo freopen("output.txt","w",stdout)
const ll inf=1e18;
const ll mod=1e9+7;
const ll maxn=500+10,maxl=2e6+10;
ll n,m,a[maxn],ans,mark[maxn];
vector <ll> nei[maxn];
ll dp[maxn][maxn][2];
void dfs(ll u){
mark[u]=1;
dp[u][0][0]=dp[u][0][1]=0;
dp[u][1][0]=dp[u][1][1]=a[u];
for(auto v:nei[u]){
if(!mark[v]){
dfs(v);
for(int i=m;i>=0;i--){
for(int j=0;j<i;j++){
if(i>=j+2){
dp[u][i][0]=max(dp[u][i][0],dp[u][i-j-2][0]+dp[v][j][1]);
dp[u][i][1]=max(dp[u][i][1],dp[u][i-j-2][1]+dp[v][j][1]);
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |