 A guy named Polycarp wants to play a game. And how this works is that game has two stats, which is the number of plays and then the number of clears. So when a player attempts to level, the number of plays increased by one. And if he manages to finish the level successfully, clears increase by one as well. So now that both of the statistics update at the same time, note that. So if the player finishes the level successfully, then the number of plays will increase at the same time as the number of clears. Polycarp is excited about this. So he basically wrote that n integers and each are with the number of plays at the ith moment and then the number of clears at the ith moment, right? And the stats are given in chronological order. So the order they're given down. So between two consecutive moments of the Polycarp, he got stats but possibly zero could attempt the level. Okay, so that means that many players, but zero could also attempt the level. So now he wonders if he hadn't messed up at all and if there exists a sequence of plays that he clears respectfully that the stats were exactly as he had written down. Okay, so pretty much we're given the number of plays and the number of clears of the level at the ith moment. And then we have to print out yes if there exists a sequence of plays that the stats were exactly as Polycarp had written down or no. Okay, so what do you have to do in this problem is actually just look at the test cases and look at the output and then we'll compare it. So I'm going to go to the pen and paper to show you guys what I mean. All right, guys, so let's look at the first test cases and we'll see figure out the pattern of what we have to write in order to get the right answer. So what I did was I wrote down the number of plays on the left side, left column. Then I wrote down the number of clears on the right column. They wrote down the output that they gave us and then the reason what they said in the output. So let's look at the first test case. Plays is zero, clears is zero. Plays is one, clears is one. Plays is one, clears is two. And they print out no. And why did they print out no? It's because the number of clears increased but the plays didn't. So what does that mean? Here, if I have one, one, one number plays and clears one and then my clears increased. So two and my plays stayed the same. That's not possible. So that means that if I was gonna increase my clear by a certain number of points, my plays had to have increased it as well. So if only to increase my clear, my number of plays had to increase. So that's the reason why this test case failed. Let's look at another one. Here we have plays is 10, clears is one. Plays is 15, clears is two. Plays is 10, clears is two. Plays is 15, number of clears is two. So why did they print out no? Number of plays decreased, which is not possible. So what we saw here is that 15, number of plays 15, dropped to 10 and that's not possible. So how do I check this then? Well, 15 dropped to 10. So if I was going to check this, that means that I have to print out no if my current value of my play is less than the previous value. So if my current value of my play is 10 and it's less than my previous 15, then I know it's not possible because the plays decreased. So it's not possible. Let's look at this one. Let's look at this no. Okay, so we have number of plays, the number of clears, we have four four and then it dropped to four three. Okay, the number of clears dropped from four to three and this print out no because the number of clears decreased, which is not possible. So we have two cases so far. If the number, if my current number of play is less than my previous number of play, then I know it's not possible, right? And then the second case that we have is if my current number of my clear three is less than my previous clear four, then we know it's not possible. Number of clears decreased is not possible. So those are two cases right now and I wrote down them down here. If my current number of clear is less than my previous number of clear, then I know it's not possible, right? It's no. I also know that if my current number of my plays is less than my previous number of plays, it's not possible. Okay, now there's the third case. So remember originally we set up here is that the, if I was gonna increase my number of clears by one, that means my plays had to have increased by one, right? Here, number of clears increased but plays in. So what does that mean? That means that if my difference, the difference of plays that I'm increasing from here to here must always be greater than or equal to the difference of clears from here to here. Because the number of clears are increased or they stayed the same. Like in this case, plays and clear, right? I could increase my play and my clears could stay the same, right? And, but if I'm gonna increase my play, my clears have to increase. So that means that the number, my difference between my increase, the value that to increase, for the difference between my current and the previous has to be greater than or equal to the difference of the clear, right? So if it's less than, I know that it's not possible, okay? So that's our third test case. If the current play subtracted by the previous play is less than the current clear minus the previous clear, it's not possible, okay? And I'll explain it again. Remember, if we increase the number of plays on the left side, we have to have increased the number of clears on the right side, right? But we don't have to, if I increase my play, I don't have to increase my clear. Remember? Like in this case, if I increase my play, one, I don't have to increase my clear, right? So that means my difference, a value of that I increased for my play must be greater than or equal to the difference of the value that I increased for my clear, okay? So that's why if it's less than, it's not possible. If the difference between my current play and my previous play is less than the current clear minus the previous clear, it's not possible, okay? So that's all the three cases of this problem. I'm gonna go and explain the code to you guys and then, yeah, that's it. Okay guys, so I'm gonna explain the code to you guys right now. So first of all, T is gonna be the number of test cases I read in, so I read in my number of test cases. Then I do a wild T minus minus to do this loop for the number of test cases that I'm doing. Okay, and then I'm gonna read in N. N is the number of values that we're supposed to input or games, whatever was the plays. We have to input, okay? All right, then I had two variables, previous C and previous P, which is a previous C was the previous number of clears and previous P is the previous value of the number of plays and I set them both to be zero, okay? That's what this code does. Set the previous P equals the previous C equals zero. Then I had a Boolean possible I set to true in the beginning, right? Okay, and then basically if I see something that's not possible, I'll set it to false and then I'll check it later in the game. To print it, yes or no, if it's true or false, okay? All right, then I loop through the number of values I'm supposed to read in, N, and I'm gonna read in my current play and then my current play and then my current number of clears, current clears, okay? So I read in the current play and then current clear. Remember our first case is if my current play subtract my previous play is less than zero then it's not possible. Remember the second case is if my current clear subtract by my previous clear is less than zero that's also not possible. So these two cases is just, it's the same thing as if my current play is less than my previous play, right? Remember we saw up there, my current play is less than my previous play in our, the first case, right? And this is the same thing as if my current clear is less than my previous clear and it's not possible, okay? Then we also have to check the difference here. So we have to check the difference between the current play and minus the previous play. It has to be less than the current clear minus the previous clear. And if that's the case, all these are, if any one of these, remember I put an or for any one of these, because it could be any one of these, that could be the case. Then I set my possible equal to false, okay? Then I update my previous play and then my previous number of clear to be the current one. And then as the loop resets, it changes the current clear and stuff like that. So yeah, that's what this part does. After that, I say if it's possible, like if my possible boolean is true, then I'm gonna return, I'm gonna not return, I'm gonna print out yes and otherwise I'll print out no. And then I return zero at the end because for C++ you have to return zero. But yeah, so that's basically the code. I hope you guys understand my, I hope you guys understand the code. I hope you guys understand this problem. Rate, comment, subscribe. I'll check you guys to get later, peace.