Source Code
#include <iostream>
#include<algorithm>
#include <cmath>
using namespace std;
int main() {
	int t;
	cin >> t;
	int n;
	cin >> n;
	
	int* ch = new int[n];
	int* wa = new int[n];
	int max1 = 0;
	int max2 = 0;
	int an = 0;
	for (int i = 1; i <= t; i++) {
		
		for (int j = 0; j < n; j++) 
			cin >> *(wa+j);
			
		
		for (int j = 0; j < n; j++) 
			cin >> *(ch+j);
			
		for (int k = 0; k < n; k++)
			if (max1< (*(ch+k) - *(wa+k)))
				max1 = ch[k] - wa[k];
		cout << max1 << endl;
		delete[] ch;
		delete[] wa;
		max1 = 0;
		if(i!=t)
		cin >> n;
		ch = new int[n];
		wa = new int[n];
	}
	



}







Copy
Garden Walls hoodlum awm
GNU G++17
117 ms
2.5 MB
Accepted