This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<algorithm>
using namespace std;
int D[2][15][2];
int main()
{
	int N;
	scanf("%d", &N);
	for(int i=0;i<=1;i++){
		for(int j=1;j<=N;j++){
			for(int k=0;k<2;k++){
				scanf("%d", D[i][j]+k);
			}
		}
	}
	int ans = 0, ch = 0;
	for(int i=1;i<=N;i++){
		int mx = max( D[0][i][0], D[1][i][0]);
		int mn = min( D[0][i][1], D[1][i][1]);
		if( mn > mx ) ans++;
		else if( mn < mx) ch = -1;
	}
	if( ch == -1 ) ans = -1;
	printf("%d", ans);
	return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |