This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <cstring>
#include <queue>
#include <cassert>
using namespace std;
typedef long long LL;
typedef vector<string> VS;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
#define MP make_pair
#define ST first
#define ND second
#define PB push_back
#define FOR(i,a,b) for( int i=(a); i<(b); ++i)
#define FORD(i,a,b) for( int i=(a); i>(b); --i)
#define REP(i,n) for(int i=0; i<(n); ++i)
#define ALL(X) (X).begin(),(X).end()
#define SZ(X) (int)(X).size()
#define FORE(it,X) for(__typeof((X).begin()) it=(X).begin(); it!=(X).end();++it)
int n;
int s[2][16],e[2][16];
int main()
{
cin>>n;
REP(j,2)
REP(i,n)
cin>>s[j][i]>>e[j][i];
int dp = n;
REP(i, n) {
if (e[0][i] < s[1][i] || e[1][i] < s[0][i]) {
dp = -1;
break;
}
if (e[0][i] == s[1][i] || e[1][i] == s[0][i])
dp--;
}
cout<<dp<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |