博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #369 (Div. 2) A. Bus to Udayland 水题
阅读量:6419 次
发布时间:2019-06-23

本文共 2474 字,大约阅读时间需要 8 分钟。

A. Bus to Udayland

题目连接:

Description

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 n rows 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.

Sample Input

6

OO|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX

Sample Output

YES

++|OX
XO|XX
OX|OO
XX|OX
OO|OO
OO|XX

Hint

题意

给你一个4n的公交车座椅排布,然后问你有没有一个连着的,两个人可以坐的位置。

题解:

直接暴力check一下就好了`

代码

#include
using namespace std;vector
ans;int main(){ int n; scanf("%d",&n); int flag = 0; for(int i=0;i
>s; if(flag==0) { if(s[0]=='O'&&s[1]=='O') { flag = 1; s[0]='+',s[1]='+'; } } if(flag==0) { if(s[3]=='O'&&s[4]=='O') { flag = 1; s[3]='+',s[4]='+'; } } ans.push_back(s); } if(flag==0)printf("NO\n"); else { printf("YES\n"); for(int i=0;i

转载地址:http://znlra.baihongyu.com/

你可能感兴趣的文章
解决C3P0在Linux下Failed to get local InetAddress for VMID问题
查看>>
1531 山峰 【栈的应用】
查看>>
巧用美女照做微信吸粉,你会做吗?
查看>>
wcf学习总结《上》
查看>>
ERROR (ClientException)
查看>>
WYSIWYG 网页在线编辑器比较表
查看>>
vss团队开发工具使用(个人学习心得)
查看>>
Load Balance 产品横向比较
查看>>
Java代理程序实现web方式管理邮件组成员
查看>>
Dell PowerEdge 1750的BIOS初始化设置
查看>>
Liferay 模板文件的解析
查看>>
基于GNS3的独臂路由配置
查看>>
【编译打包】tengine 1.5.1 SRPM
查看>>
看图说话:手动清除病毒文件流程
查看>>
3分钟实操机器学习原理,这里有一个不挑人的模型 | 包教包会
查看>>
一句话下拖库
查看>>
Deploy Office Communications Server 2007R2 Group Chat Server(二)
查看>>
在Cacti上实现MSN报警机制
查看>>
如何对C++虚基类构造函数
查看>>
docker1.12-containerd源码分析
查看>>