fork(2) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5. int n;
  6. scanf("%d", &n);
  7.  
  8. int* h = (int*)malloc(sizeof(int) * n);
  9. int* w = (int*)malloc(sizeof(int) * n);
  10. int count;
  11.  
  12. for (int i = 0; i < n; i++) {
  13. scanf("%d %d", &h[i], &w[i]);
  14. }
  15.  
  16. for (int i = 0; i < n; i++) {
  17. count = 0;
  18. for(int k=0; k<n; k++){
  19. if ((h[i] < h[k]) && (w[i] < w[k])) {
  20. count++;
  21.  
  22. }
  23.  
  24. }
  25. printf("%d", count+1);
  26. }
  27. free(h);
  28. free(w);
  29.  
  30.  
  31. }
Success #stdin #stdout 0s 4276KB
stdin
5
55 185
58 183
88 186
60 175
46 155
stdout
22125