Submission #18705

# Submission time Handle Problem Language Result Execution time Memory
18705 2016-02-14T10:27:00 Z kdh9949 N-orthotope (kriii2_N) C++
0 / 4
0 ms 1084 KB
#include <cstdio>
#include <algorithm>
using namespace std;
 
int insec(int s1, int e1, int s2, int e2){
  if(s1 > s2) swap(s1, s2), swap(e1, e2);
  if(s2 < e1) return 1;
  if(s2 == e1) return 0;
  return -1;
}
 
int n, s1[11], s2[11], e1[11], e2[11];
int ans;
 
int main(){
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d%d", s1 + i, e1 + i);
  for(int i = 0; i < n; i++) scanf("%d%d", s2 + i, e2 + i);
  ans = n;
  for(int i = 0; i < n; i++){
    if(insec(s1[i], e1[i], s2[i], e2[i]) == 0) ans--;
    if(insec(s1[i], e1[i], s2[i], e2[i]) < 0) {puts("0"); return 0;}
  }
  printf("%d", ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -