fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n, nowa=-1, nowb=-1, a, b, flag=1;
  7.  
  8. cin>>n;
  9.  
  10. while(n--){
  11. cin>>a>>b;
  12.  
  13. if(nowa >a || nowb >b){
  14. cout<<"no";
  15. return 0;
  16. }
  17.  
  18. nowa=a;
  19. nowb=b;
  20. }
  21.  
  22. cout<<"yes";
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 5320KB
stdin
5
1 2
0 0
4 3
2 3
5 5
stdout
no