ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has nrows of seats. There are 4 seats in each row, and the seats are separated into pairs by a walkway. When ZS and Chris came, some places in the bus was already occupied.
ZS and Chris are good friends. They insist to get a pair of neighbouring empty seats. Two seats are considered neighbouring if they are in the same row and in the same pair. Given the configuration of the bus, can you help ZS and Chris determine where they should sit?
The first line of the input contains a single integer n (1 ≤ n ≤ 1000) — the number of rows of seats in the bus.
Then, n lines follow. Each line contains exactly 5 characters, the first two of them denote the first pair of seats in the row, the third character denotes the walkway (it always equals '|') and the last two of them denote the second pair of seats in the row.
Each character, except the walkway, equals to 'O' or to 'X'. 'O' denotes an empty seat, 'X' denotes an occupied seat. See the sample cases for more details.
If it is possible for Chris and ZS to sit at neighbouring empty seats, print "YES" (without quotes) in the first line. In the next n lines print the bus configuration, where the characters in the pair of seats for Chris and ZS is changed with characters '+'. Thus the configuration should differ from the input one by exactly two charaters (they should be equal to 'O' in the input and to '+' in the output).
If there is no pair of seats for Chris and ZS, print "NO" (without quotes) in a single line.
If there are multiple solutions, you may print any of them.
6
OO|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX
YES
++|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX
4
XO|OX
XO|XX
OX|OX
XX|OX
NO
5
XX|XX
XX|XX
XO|OX
XO|OO
OX|XO
YES
XX|XX
XX|XX
XO|OX
XO|++
OX|XO
Note that the following is an incorrect configuration for the first sample case because the seats must be in the same pair.
O+|+X
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX
题意:n排座位 每排两对座位 X代表已经被占了 现在两个人找座位 座位必须是某一对
若能找到输出YES 并用+标注找到的座位 否则输出NO
题解:模拟暴力
1 /****************************** 2 code by drizzle 3 blog: www.cnblogs.com/hsd-/ 4 ^ ^ ^ ^ 5 O O 6 ******************************/ 7 #include<bits/stdc++.h> 8 #include<iostream> 9 #include<cstring> 10 #include<cstdio> 11 #include<map> 12 #include<algorithm> 13 #include<queue> 14 #define ll __int64 15 using namespace std; 16 int n; 17 char a[1005][10]; 18 int main() 19 { 20 scanf("%d",&n); 21 int flag=1; 22 for(int i=1; i<=n; i++) 23 { 24 getchar(); 25 for(int j=1; j<=5; j++) 26 { 27 scanf("%c",&a[i][j]); 28 if(flag) 29 { 30 if(j==2) 31 { 32 if(a[i][1]=='O'&&a[i][2]=='O') 33 { 34 a[i][1]='+'; 35 a[i][2]='+'; 36 flag=0; 37 } 38 } 39 } 40 if(flag) 41 { 42 if(j==5) 43 { 44 if(a[i][4]=='O'&&a[i][5]=='O') 45 { 46 a[i][4]='+'; 47 a[i][5]='+'; 48 flag=0; 49 } 50 } 51 } 52 } 53 } 54 if(flag==0) 55 { 56 printf("YES\n"); 57 for(int i=1; i<=n; i++) 58 { 59 for(int j=1; j<=5; j++) 60 printf("%c",a[i][j]); 61 printf("\n"); 62 } 63 } 64 else 65 printf("NO\n"); 66 return 0; 67 }