# PROBLEM LINK:

* Author:* Prasoon Jain

*Prasoon Jain*

**Tester:***Pratima Singh*

**Editorialist:**# DIFFICULTY:

EASY

# PREREQUISITES:

Simple observation, no prerequisites.

# PROBLEM:

There is an IPL match between Mumbai and Delhi. Mumbai won the toss and decided to bat first. We are given a strategy following which Mumbai can **win**, and it is to score **at least one boundary in every six balls.** Boundary means scoring **4 or 6** runs. Formally, for Mumbai to win there MUST not be six consecutive balls where a boundary is not scored. Otherwise, if for any six consecutive balls a **boundary** is **NOT** scored, Mumbai will **lose** the match.

You are given integer **N** i.e. total number of balls in the innings and an array **A**, where **Ai** is the runs scored on the i-th ball. If the Mumbai team followed the above-mentioned strategy throughout the innings print *WON*, else print *LOST*.

# EXPLANATION:

We are given an array where each i-th element represents the run scored on that ball. For Mumbai to win there must be at least one boundary for every six ball. So, we will traverse the array and check *for every six ball if there is at least one boundary or not*.

Let us count the number of balls on which boundary isn’t scored and keep track of them in a variable **count**.

Let us assume another boolean variable, **flag** that will be *true if count goes beyond or becomes equal to 6*, we’ll come out of the loop as Mumbai will lose in that case (for more than or equal to six balls no boundary was hit). If a boundary is encountered we’ll make the count again zero and if the count becomes greater than or equal to zero i.e. for six consecutive balls no boundary was scored then we make our flag variable true i.e. our strategy didn’t work and Mumbai lost the match there.

# SOLUTION:

## Editorialist's Solution

```
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int count=0;
bool flag = false;
for(int i=0;i<n;i++){
if(arr[i]==6 || arr[i]==4)
count = 0;
else
count+=1;
if(count>=6){
flag = true;
break;
}
}
if(flag)
cout<<"LOST"<<endl;
else
cout<<"WON"<<endl;
}
return 0;
}
```