This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/* 문제
*/
// 2014.
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
using namespace std;
int det[12];
vector <int> s[2], e[2];
int main()
{
int n,ans = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
int x, y;
scanf("%d%d", &x, &y);
s[0].push_back(x);
e[0].push_back(y);
}
bool det2 = false;
for (int i = 0; i < n; i++)
{
int x, y;
scanf("%d%d", &x, &y);
if (s[0][i] > x)
{
if (e[0][i] > y)
{
det[i] = y - s[0][i];
}
else
{
det[i] = e[0][i] - s[0][i];
}
}
else
{
if (e[0][i] > y)
{
det[i] = y - x;
}
else
{
det[i] = e[0][i] - x;
}
}
if (det[i] < 0)
{
det2 = true;
}
}
if (det2 == true)
{
printf("-1\n");
return 0;
}
for (int i = 0; i < n; i++)
{
if (det[i] > 0)
ans++;
}
printf("%d\n", ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |