Source Code
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;

	long long int* pi = new long long int[n];
	long long int* ci = new long long int[n];

	int total = 0;

	long long int team1, team2;
	long long int team1x=0, team1y=0, team2x=0, team2y=0;

	for (int i = 0; i < n; i++) {
		cin >> pi[i] >> ci[i];
	}

	for (int i = 0; i < n; i++) {
		if (i < n / 2)
		{
			team1x += pi[i];
			team1y += ci[i];
		}
		else
		{
			team2x += pi[i];
			team2y += ci[i];
		}
	}

	team1 = team1x > team1y ? team1x : team1y;

	team2 = team2x > team2y ? team2x : team2y;


	cout << team1 + team2;
}
Copy
Two Teams Qusay
GNU G++17
3 ms
692 KB
Wrong Answer