Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int testcase;
- cin>>testcase;
- for(int j=0; j<testcase; j++)
- {
- int field, flag=0, check_play, check_win;
- cin>>field;
- int play[field], win[field];
- for(int i=0; i<field; i++)
- {
- cin>>play[i]>>win[i];
- }
- if(play[0]<win[0])
- {
- flag++;
- }
- for(int i=1; i<field; i++)
- {
- if(play[i]<win[i])
- {
- flag++;
- }
- check_play=play[i]-play[i-1];
- check_win=win[i]-win[i-1];
- if(check_play<0 || check_win<0)
- {
- flag++;
- }
- if(check_play<check_win)
- {
- flag++;
- }
- }
- if(flag>0)
- {
- cout<<"NO"<<endl;
- }
- else
- cout<<"Yes"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement