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<stdio.h>
int min(int a, int b)
{
return (a < b) ? a : b;
}
int max(int a, int b)
{
return (a>b) ? a : b;
}
int main(void)
{
int N, s[11], e[11], si, ei, M = 0, mi, ma,value;
scanf("%d", &N);
for (int i = 0; i < N; i++)
{
scanf("%d %d", &s[i], &e[i]);
}
for (int i = 0; i < N; i++)
{
scanf("%d %d", &si, &ei);
mi = min(min(si, ei), min(s[i], e[i]));
ma = max(max(si, ei), max(s[i], e[i]));
value = ma - mi - (ei - si + e[i] - s[i]);
if (value>0)
{
printf("-1");
return 0;
}
if (value < 0)
{
M++;
}
}
printf("%d", M);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |