about summary refs log tree commit diff
path: root/others/easy20160714/30.c
blob: b2ca347ec5a89c4ec77877d694899d227897a7d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>

int main()
{
	FILE *f = fopen("INP.TXT", "r");
	int n, m, l, r, t, b;

	fscanf(f, "%d", &n);

	fscanf(f, "%d", &m);
	l = r = m;
	fscanf(f, "%d", &m);
	t = b = m;

	for (n--; n; n--) {
		fscanf(f, "%d", &m);
		l = (m < l) ? m : l;
		r = (m > r) ? m : r;

		fscanf(f, "%d", &m);
		t = (m < t) ? m : t;
		b = (m > b) ? m : b;
	}

	fclose(f);

	f = fopen("OUT.TXT", "w");
	fprintf(f, "%d\n", (r - l > b - t) ? r - l : b - t);
	fclose(f);

	return 0;
}