Source Code
#include<iostream>
using namespace std;

int main() {

	int iterations, size;
	int min = INT16_MAX;
	int max = 0;
	int* a;
	int* b;
	cin >> iterations >> size;
	a = new int[size];
	b = new int[size];
	for (int i = 0; i < iterations; i++) {
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < size; k++) {
				if (j == 0) {
					cin >> a[k];
					if (a[k] < min) {
						min = a[k];
					}
				}
				else {
					cin >> b[k];
					if (a[k] > max) {
						max = b[k];
					}
				}
			}
		}
		cout << max - min << endl;
	}

	return 0;
}
Copy
Garden Walls MarwanMoraly
GNU G++17
3 ms
320 KB
Wrong Answer