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 <cstdio>
#include <vector>
const int kModulo = 1000000007;
int main() {
int N;
scanf("%d", &N);
if (N == 1) {
int a, b;
int ap, bp;
scanf("%d%d", &a, &b);
scanf("%d%d", &ap, &bp);
if (a > bp || b < ap) {
printf("-1");
} else if (b == ap || bp == a) {
printf("0");
} else {
printf("1");
}
} else if (N == 2) {
int a, b, c, d;
int ap, bp, cp, dp;
scanf("%d%d%d%d", &a, &c, &b, &d);
scanf("%d%d%d%d", &ap, &cp, &bp, &dp);
if (a > cp || c < ap || b > dp || d < bp) {
printf("-1");
} else if (a >= cp || c <= ap || b >= dp || d <= bp) {
if ((a == cp && b == dp) || (c == ap && d == bp) ||
(c == ap && b == dp) || (a == cp && d == bp)) {
printf("0");
} else {
printf("1");
}
} else {
printf("2");
}
}
//for (int i = 0; i < 2; ++i) {
// for (int j = 0; j < N; ++j) {
// }
//}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |