Skip to content

Commit 655231b

Browse files
committed
Added 711A - Bus to Udayland.cpp
1 parent 2d25e46 commit 655231b

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

711A - Bus to Udayland.cpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
int emptySeat(string x)
7+
{
8+
if(x.substr(0,2)== "OO")
9+
{
10+
return -1;
11+
}
12+
else if(x.substr(3,2)=="OO")
13+
{
14+
return 1;
15+
}
16+
else
17+
{
18+
return 0;
19+
}
20+
}
21+
22+
int main()
23+
{
24+
int n;
25+
cin>>n;
26+
string s[n];
27+
for(int i=0;i<n;i++)
28+
{
29+
cin>>s[i];
30+
}
31+
32+
bool empty=false;
33+
for(int i=0;i<n;i++)
34+
{
35+
if(emptySeat(s[i])==-1)
36+
{
37+
empty=true;
38+
s[i].replace(0,2,"++");
39+
break;
40+
}
41+
else if(emptySeat(s[i])==1)
42+
{
43+
empty=true;
44+
s[i].replace(3,2,"++");
45+
break;
46+
}
47+
}
48+
if(empty)
49+
{
50+
cout<<"YES"<<endl;
51+
for(int i=0;i<n;i++)
52+
{
53+
cout<<s[i]<<endl;
54+
}
55+
}
56+
else
57+
{
58+
cout<<"NO"<<endl;
59+
}
60+
61+
}
62+
63+
64+
65+
66+
67+
68+
69+

0 commit comments

Comments
 (0)