Unfortunately we were unable to fully decode your file, as it is not encoded in UTF-8. You can try to decode it yourself by downloading it here.
 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//Plemiona, PA 2014, runda 5
//Wiktoria Ko�ny
#include<cstdio>
#include<algorithm>
using namespace std;

const int MN=100003;
int n, iple=0;
int ple[MN][4], nowy[4];
pair<pair<int, int>, pair<int, int> > kple[MN];

void usun(int v){
	int d;
	for(d=0; d<4; d++)
		ple[v][d]=ple[iple-1][d];
	iple--;
}

int main(){
	int i, j, d, czy;
	scanf("%d", &n);
	
	for(i=0; i<n; i++){
		//printf("i %d\n", i);
		for(d=0; d<4; d++)
			scanf("%d", &nowy[d]);
		czy=1;
		while(czy==1){
			//printf("hello\n");
			for(j=iple-1; j>=0; j--){
				if(!( nowy[0]>=ple[j][1] || ple[j][0]>=nowy[1] || nowy[2]>=ple[j][3] || ple[j][2]>=nowy[3])){
					if(ple[j][0]<nowy[0])
						nowy[0]=ple[j][0];
					if(ple[j][2]<nowy[2])
						nowy[2]=ple[j][2];
					if(ple[j][1]>nowy[1])
						nowy[1]=ple[j][1];
					if(ple[j][3]>nowy[3])
						nowy[3]=ple[j][3];
					czy=0;
					usun(j);
					break;
				}
			}
			czy=1-czy;
		}
		for(d=0; d<4; d++)
			ple[iple][d]=nowy[d];
		iple++;
	}
	/*for(j=0; j<iple; j++){
		for(d=0; d<4; d++)
			printf("%d ", ple[j][d]);
		printf("\n");
	}*/
	
	for(j=0; j<iple; j++){
		kple[j].first.first=ple[j][0];
		kple[j].first.second=ple[j][1];
		kple[j].second.first=ple[j][2];
		kple[j].second.second=ple[j][3];
	}
	sort(kple, kple+iple);
	printf("%d\n", iple); 
	for(j=0; j<iple; j++)
		printf("%d %d %d %d\n", kple[j].first.first, kple[j].first.second, kple[j].second.first, kple[j].second.second);
	return 0;
}