Submission #848967

# Submission time Handle Problem Language Result Execution time Memory
848967 2023-09-13T18:50:46 Z ssense Homecoming (BOI18_homecoming) C++14
0 / 100
25 ms 13648 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#include "homecoming.h"
 
long long solve(int N, int K, int *A, int *B) {
 
	long long cost = 0, ans = 0;
	cost = 0;
	for (int i = 0; i < K; i++)
		cost += B[i];
 
	long long take = A[0] - cost, leave = 0LL;
 
	ans = max(ans, take);
	ans = max(ans, leave);
 
	for (int i = 1; i < N; i++) {
		
		cost -= B[i - 1];
		int new_cost = B[(i + K - 1) % N];
 
		long long now_take = max(take, leave - cost) + A[i] - new_cost;
		long long now_leave = max(take, leave);
 
		cost += new_cost;
 
		take = now_take;
		leave = now_leave;
 
		ans = max(ans, take);
		ans = max(ans, leave);
	}
 
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 13648 KB Output is correct
2 Incorrect 2 ms 864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -