Submission #9521

#TimeUsernameProblemLanguageResultExecution timeMemory
9521dolpang2N-orthotope (kriii2_N)C++14
1 / 4
0 ms1088 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...