Language: C++

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

double sum(int j,int k,vector<int> A ) {
	double total = 0;
	for (int i = j;i < k;i++) {
		total += A[i];
	}
	return total;
}

int main() {
	int ans;
	int N;
	cin >> N;
	vector<double> A(N);
	for (int i = 0;i < N;i++) {
		cin >> A[i];
	}

	for (int i = 2;i <= N-2;i++) {	//真ん中スラッシュを入れる位置決定
		int slash_middle = i;

		//真ん中スラッシュより左
		double sum_PQ = sum(0,slash_middle, A);
		int slash_left_decision = 1;
		double difference_PQ_min = fabs(A[0] - (sum_PQ / 2));
		for (int i = 1;i < slash_middle;i++) {	//左スラッシュを入れる位置決定
			int slash_left = i;
			double P = sum(0,slash_left, A);
			//どのスラッシュの位置が最もPQ間の差が小さいか判定
			if (fabs(P - (sum_PQ / 2)) <= difference_PQ_min) {
				slash_left_decision = slash_left;
				difference_PQ_min = fabs(P - (sum_PQ / 2));
			}
		}
		int P_decision = sum(0, slash_left_decision, A);
		int Q_decision = sum(slash_left_decision, slash_middle,A);
		//cout << P_decision << "  " << Q_decision << endl;
		

		//真ん中スラッシュより右
		double sum_RS = sum(slash_middle, N, A);
		//cout << "sum_RS/2 " << sum_RS/2 << endl;
		int slash_right_decision = slash_middle + 1;
		double difference_RS_min = fabs(A[slash_middle] - (sum_RS / 2));
		//cout << "difference_RS_min " << difference_RS_min << endl;
		for (int i = slash_middle+1;i < N;i++) {	//右スラッシュを入れる位置決定
			int slash_right = i;
			double R = sum(slash_middle,slash_right, A);
			//どのスラッシュの位置が最もRS間の差が小さいか判定
			//cout << R << endl;
			if (fabs(R - (sum_RS / 2)) <= difference_RS_min) {
				slash_right_decision = slash_right;
				difference_RS_min = fabs(R - (sum_RS / 2));
			}
		}
		//cout << slash_right_decision << endl;
		int R_decision = sum(slash_middle, slash_right_decision, A);
		int S_decision = sum(slash_right_decision, N, A);
		//cout << R_decision << "  " << S_decision << '\n' << endl;
		
		int P_Q_R_S[4];
		P_Q_R_S[0] = P_decision;
		P_Q_R_S[1] = Q_decision;
		P_Q_R_S[2] = R_decision;
		P_Q_R_S[3] = S_decision;

		sort(P_Q_R_S, P_Q_R_S + 4);

		/*
		for (int i = 0;i < 4;i++) {
			cout << P_Q_R_S[i] << endl;
		}
		*/

		if (i == 2) {
			ans = P_Q_R_S[3] - P_Q_R_S[0];
		}else if(ans > (P_Q_R_S[3] - P_Q_R_S[0])) {
			ans = P_Q_R_S[3] - P_Q_R_S[0];
		}
		//cout << P_Q_R_S[3] - P_Q_R_S[0] << endl;

	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:53: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   28 |                 double sum_PQ = sum(0,slash_middle, A);
      |                                                     ^
      |                                                     |
      |                                                     vector<double>
a.cc:30:44: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   30 |                 double difference_PQ_min = fabs(A[0] - (sum_PQ / 2));
      |                                            ^~~~
      |                                            labs
a.cc:33:54: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   33 |                         double P = sum(0,slash_left, A);
      |                                                      ^
      |                                                      |
      |                                                      vector<double>
a.cc:40:62: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   40 |                 int P_decision = sum(0, slash_left_decision, A);
      |                                                              ^
      |                                                              |
      |                                                              vector<double>
a.cc:41:72: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   41 |                 int Q_decision = sum(slash_left_decision, slash_middle,A);
      |                                                                        ^
      |                                                                        |
      |                                                                        vector<double>
a.cc:46:54: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   46 |                 double sum_RS = sum(slash_middle, N, A);
      |                                                      ^
      |                                                      |
      |                                                      vector<double>
a.cc:53:66: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   53 |                         double R = sum(slash_middle,slash_right, A);
      |                                                                  ^
      |                                                                  |
      |                                                                  vector<double>
a.cc:62:74: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   62 |                 int R_decision = sum(slash_middle, slash_right_decision, A);
      |                                                                          ^
      |                                                                          |
      |                                                                          vector<double>
a.cc:63:63: error: could not convert 'A' from 'vector<double>' to 'vector<int>'
   63 |                 int S_decision = sum(slash_right_decision, N, A);
      |                                                               ^
      |                                                               |
      |                                                               vector<double>