Submission #646487

# Submission time Handle Problem Language Result Execution time Memory
646487 2022-09-29T21:21:46 Z Alenygam Homecoming (BOI18_homecoming) C++14
0 / 100
28 ms 15620 KB
#include <bits/stdc++.h>
#include "homecoming.h"

using namespace std;

long long int solve(int N, int K, int *A, int *B) {
	int pfB[N]; pfB[0] = B[0];
	for (int i = 1; i < N; i++) {
		pfB[i] = pfB[i - 1] + B[i];
	}

	long long res = 0;

	for (int i = 0; i < N; i++) {
		long long b;
		if (i == 0) {
			b = pfB[K];
		} else {
			b = pfB[min((i + K - 1), N - 1)] - pfB[i - 1];
			if ((i + K - 1) >= N) b += pfB[(i + K - 1) % N];
		}

		if (A[i] > b) res += A[i] - b;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 15620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -