time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

 

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?

Input

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.

Output

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.

Examples
input
6
OO|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX
output
YES
++|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX
input
4
XO|OX
XO|XX
OX|OX
XX|OX
output
NO
input
5
XX|XX
XX|XX
XO|OX
XO|OO
OX|XO
output
YES
XX|XX
XX|XX
XO|OX
XO|++
OX|XO
Note

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

题意:

找出第一对单边连续的O并将它们转换成+输出。

附AC代码:

 #include<bits/stdc++.h>
using namespace std; int main(){
char s[][];
int n;
int ans=;
int flag=;
cin>>n;
while(n--){
cin>>s[ans];
if(s[ans][]=='O'&&s[ans][]=='O'&&!flag){ flag=;
s[ans][]='+';
s[ans][]='+'; }
else if(s[ans][]=='O'&&s[ans][]=='O'&&!flag){ flag=;
s[ans][]='+';
s[ans][]='+'; }
ans++;
}
if(flag){
cout<<"YES"<<endl;
for(int i=;i<ans;i++){
cout<<s[i]<<endl;
}
}
else
cout<<"No"<<endl;
return ;
}

A. Bus to Udayland的更多相关文章

  1. codeforces 711A A. Bus to Udayland(水题)

    题目链接: A. Bus to Udayland 题意: 找一对空位坐下来,水; 思路: AC代码: #include <iostream> #include <cstdio> ...

  2. Codeforces Round #369 (Div. 2) A. Bus to Udayland 水题

    A. Bus to Udayland 题目连接: http://www.codeforces.com/contest/711/problem/A Description ZS the Coder an ...

  3. Codeforces Round #369 (Div. 2) A. Bus to Udayland【字符串/二维字符数组求连起来的座位并改为其他字符】

    A. Bus to Udayland time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. Codeforces Round #369 (Div. 2) A. Bus to Udayland (水题)

    Bus to Udayland 题目链接: http://codeforces.com/contest/711/problem/A Description ZS the Coder and Chris ...

  5. CodeForces 711A Bus to Udayland (水题)

    题意:给定一个n*4的矩阵,然后O表示空座位,X表示已经有人了,问你是不能找到一对相邻的座位,都是空的,并且前两个是一对,后两个是一对. 析:直接暴力找就行. 代码如下: #pragma commen ...

  6. 【模拟】Codeforces 711A Bus to Udayland

    题目链接: http://codeforces.com/problemset/problem/711/A 题目大意: N个字符串,每个字符串5位,找到第一个出现两个OO的并改成++输出YES和改后字符 ...

  7. CodeForces 711A Bus to Udayland

    简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...

  8. 洛谷 题解 CF711A 【Bus to Udayland】

    先用一个字符数组存每行的座位情况(字符变量也可以) 接下来用另一个数组存最后的座位情况 好了,看代码 #include<iostream> using namespace std; boo ...

  9. Codeforces Round #369 (Div. 2) A B 暴力 模拟

    A. Bus to Udayland time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

随机推荐

  1. ubuntu uninstall postgres

    Steps that worked for me on Ubuntu 8.04.2 to remove postgres 8.3 List All Postgres related packages ...

  2. 使用Python控制1602液晶屏实时显示时间(附PyCharm远程调试)

    前言 原创文章,转载引用务必注明链接.水平有限,如有疏漏,欢迎指正. 本文介绍一下UP板的GPIO资源使用,以及一个使用Python演示一个简单的demo. 本文使用Markdown写成,为获得更好的 ...

  3. 全文索引--自己定义chinese_lexer词典

    本文来具体解释一下怎样自己定义chinese_lexer此法分析器的词典 初始化数据 create table test2 (str1 varchar2(2000),str2varchar2(2000 ...

  4. JavaScript 模拟键盘事件

    JavaScript 模拟键盘事件和鼠标事件(比如模拟按下回车等) 2016年09月08日 15:23:25 神秘_博士 阅读数:41158 标签: javascript鼠标键盘事件模拟更多 个人分类 ...

  5. ListView 实现带有Filpper效果的左右滑动删除 Item

    ListView 实现带有Filpper效果的左右滑动删除 Item  的实现最基本的方法还是 对 Listview 的继承重写 .然后是在删除过程中加入 TranslateAnimation 滑动事 ...

  6. 【java】itoo项目实战之hibernate 批量保存优化

    在itoo中.基本上每一个系统都有一个导入功能,大量的数据填写进入excel模板中.然后使用导入功能导入的数据库中,这样能够大大的提高工作效率. 那么导入就涉及到了批量保存数据库的问题了. 那么通常情 ...

  7. Python 包的制作(__init__.py)

    如何制作一个自己的包:首先,需要创建一个文件夹,将其作为顶层包,在此文件夹内我们可以定义各个不同的子文件夹与 .py 文件作为各个子包与模块注意:在每个包文件夹下都需要有一个 __init__.py ...

  8. 程序设计之另一种读写函数---writev,readv

    read()和write()系统调用每次在文件和进程的地址空间之间传送一块连续的数据.但是,应用有时也需要将分散在内存多处地方的数据连续写到文件中,或者反之.在这种情况下,如果要从文件中读一片连续的数 ...

  9. HDU 6068 Classic Quotation KMP+DP

    Classic Quotation Problem Description When online chatting, we can save what somebody said to form h ...

  10. (31)java web的hibernate使用-一级缓存,二级缓存

    参考:https://blog.csdn.net/miachen520/article/details/52195832 hibernate自带一级缓存 和 二级缓存 一,一级缓存: 基于Sessio ...