Submission #128253

# Submission time Handle Problem Language Result Execution time Memory
128253 2019-07-10T15:15:55 Z thanos Homecoming (BOI18_homecoming) C++14
0 / 100
43 ms 17912 KB
#include<iostream>
#include<homecoming.h>
using namespace std;
long long int C(int i,int j,int u,int *B){
  int sum=0;
  for(int k=j; k<=j+u-1; k++){
    if(j==0) break;
    if(k>=i){
      sum-=B[k-1];
    }
  }
  for(int k=i; k<=i+u-1; k++){
    sum+=B[k-1];
  }
  return sum;
}
long long int solve(int N,int K,int *A,int *B){
  int BB[10005];
  for(int i=0; i<N; i++){
    BB[i]=BB[i+N]=B[i];
  }
  long long int dp[10005]={0};
  long long int mx=0;
  for(int i=1; i<=N; i++){
    for(int j=i-1; j>=0; j--){
      dp[i]=max(dp[i],dp[j]+A[i-1]-C(i,j,K,BB));
      mx=max(mx,dp[i]);
    }
  }
  return mx;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 43 ms 17912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -