#include<iostream> #include<stdio.h> using namespace std; int main(){ int jump; int T; int n; int j; int trap[100][2];int flag; std::cin>>T; while(T--){ std::cin>>n; jump=0; flag=1; for(int i=0;i<n;i++){ std::cin>>trap[i][0]; std::cin>>trap[i][1]; } for(j=0;j<n;j++){ if(jump<trap[j][1]-trap[j][0]){ jump=trap[j][1]-trap[j][0]; } } for(int i=0;i<n-1;i++){ if(trap[i][0]+jump>trap[i+1][0]){ flag=0; } } if(flag==0){ std::cout<<"NO"; } else{ std::cout<<"YES"; } } return 0; } /* Main.cc:9:2: error: stray '\357' in program int trap[100][2];int flag; ^ Main.cc:9:2: error: stray '\274' in program Main.cc:9:2: error: stray '\233' in program Main.cc: In function 'int main()': Main.cc:10:2: error: expected initializer before 'std' std::cin>>T; ^ Main.cc:14:3: error: 'flag' was not declared in this scope flag=1; ^ */ |
Double click to view unformatted code.