A. Bus to Udayland

题目连接:

http://www.codeforces.com/contest/711/problem/A

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<bits/stdc++.h>
using namespace std;
vector<string>ans;
int main()
{
int n;
scanf("%d",&n);
int flag = 0;
for(int i=0;i<n;i++)
{
string s;
cin>>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<n;i++)
cout<<ans[i]<<endl;
}
}

Codeforces Round #369 (Div. 2) A. Bus to Udayland 水题的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  4. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  5. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  6. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  7. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  8. Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题

    A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...

  9. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

随机推荐

  1. 何凯文每日一句||DAY10

  2. Spring RedisTemplate操作-Set操作(5)

    @Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...

  3. Automate Tdxw

    Automate trade module in Tdxw Code # coding: utf-8 """ Created on Thu Dec 07 10:57:45 ...

  4. 第13月第16天 ios keywindow

    1. 在弹出层弹出后keywindow已改变 http://www.jianshu.com/p/4695d7efa20b

  5. ACM数据对拍程序

    #include<cstdio> #include<cstdlib> #include<ctime> int main() { long s,t; while(1) ...

  6. 【并行计算】用MPI进行分布式内存编程(一)

    通过上一篇关于并行计算准备部分的介绍,我们知道MPI(Message-Passing-Interface 消息传递接口)实现并行是进程级别的,通过通信在进程之间进行消息传递.MPI并不是一种新的开发语 ...

  7. centos:SSH登录时间很慢

      vi /etc/ssh/sshd_config   GSSAPIAuthentication 改为 no 开启UseDNS,值改为 no   service sshd restart

  8. [golang note] 环境搭建

    LiteIDE(windows) • golang安装 ▶ 下载对应操作系统的版本并安装,下载地址:http://www.golangtc.com/download,譬如这里下载的是go1.6.win ...

  9. 转 Spring Boot之No session repository could be auto-configured, check your configuration问题解决

    1.  环境介绍 JDK 1.8  Spring-Boot 1.5.1.RELEASE, STS IDE 2.  问题的提出 创建了一个非常简约的Spring Boot Web Application ...

  10. DEEP COMPRESSION小记

    2016ICLR最佳论文 Deep Compression: Compression Deep Neural Networks With Pruning, Trained Quantization A ...