87492024-01-28 17:25:44IgnácVásárlás (75 pont)cpp17Forditási hiba
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	long long n;
	cin >> n;
	vector<long long> a(n), b(n);
	for (long long i = 0; i < n; i++) {
		cin >> a[i];
	}

	long long sum = 0, sum2 = 0, min1 = long long_MAX, max2 = long long_MIN, min1i = 0, max2i = 0, max2min1i = 0;
	for (long long i = 0; i < n; i++) {
		cin >> b[i];
		sum2 += b[i];
		sum += b[i] - a[i];
		if (sum < min1) {
			min1 = sum;
			min1i = i;
		}
		if (sum - min1 > max2) {
			max2 = sum - min1;
			max2i = i;
			max2min1i = min1i;
		}
	}

	cout << sum2 - max2;
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:14:45: error: expected primary-expression before 'long'
   14 |         long long sum = 0, sum2 = 0, min1 = long long_MAX, max2 = long long_MIN, min1i = 0, max2i = 0, max2min1i = 0;
      |                                             ^~~~
main.cpp:21:25: error: 'min1i' was not declared in this scope; did you mean 'min1'?
   21 |                         min1i = i;
      |                         ^~~~~
      |                         min1
main.cpp:23:34: error: 'max2' was not declared in this scope
   23 |                 if (sum - min1 > max2) {
      |                                  ^~~~
main.cpp:25:25: error: 'max2i' was not declared in this scope
   25 |                         max2i = i;
      |                         ^~~~~
main.cpp:26:25: error: 'max2min1i' was not declared in this scope
   26 |                         max2min1i = min1i;
      |                         ^~~~~~~~~
main.cpp:26:37: error: 'min1i' was not declared in this scope; did you mean 'mi...