A. Bus to Udayland
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
  1. 6
    OO|OX
    XO|XX
    OX|OO
    XX|OX
    OO|OO
    OO|XX
output
  1. YES
    ++|OX
    XO|XX
    OX|OO
    XX|OX
    OO|OO
    OO|XX
input
  1. 4
    XO|OX
    XO|XX
    OX|OX
    XX|OX
output
  1. NO
input
  1. 5
    XX|XX
    XX|XX
    XO|OX
    XO|OO
    OX|XO
output
  1. 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

【分析】:我,傻逼,把字符数组写错成了整型数组,De了好久bug!

【代码】:

  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. char a[][];
  5. int main()
  6. {
  7. int n;
  8. while(~scanf("%d",&n))
  9. {
  10. for(int i=;i<n;i++)
  11. {
  12. scanf("%s",a[i]);
  13. }
  14. int f=;
  15. for(int i=;i<n;i++)
  16. {
  17. if(a[i][]==a[i][]&&a[i][]=='O')
  18. {
  19. f=;
  20. a[i][]=a[i][]='+';
  21. break;
  22. }
  23. if(a[i][]==a[i][]&&a[i][]=='O')
  24. {
  25. f=;
  26. a[i][]=a[i][]='+';
  27. break;
  28. }
  29. }
  30. if(f==)
  31. {
  32. printf("YES\n");
  33. for(int i=;i<n;i++)
  34. {
  35. for(int j=;j<;j++)
  36. {
  37. printf("%c",a[i][j]);
  38. }
  39. printf("\n");
  40. }
  41. }
  42. else
  43. {
  44. printf("NO\n");
  45. }
  46. }
  47. return ;
  48. }

注意是char数组!

  1. void print1(int n)
  2. {
  3. for(i=;i<n;i++)
  4. {
  5. printf("%s",s[i]);
  6. printf("\n");
  7. }
  8. }
  9.  
  10. void print2(int n)
  11. {
  12. for(int i = ; i < n; i++)
  13. {
  14. for(int j = ; j < ; j++)
  15. {
  16. cout << s[i][j];
  17. }
  18. cout << '\n';
  19. }
  20. }

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

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

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

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

  4. Codeforces Round #436 (Div. 2)C. Bus 模拟

    C. Bus time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input out ...

  5. Codeforces Round #484 (Div. 2) B. Bus of Characters(STL+贪心)982B

    原博主:https://blog.csdn.net/amovement/article/details/80358962 B. Bus of Characters time limit per tes ...

  6. Codeforces Round #369 (Div. 2)---C - Coloring Trees (很妙的DP题)

    题目链接 http://codeforces.com/contest/711/problem/C Description ZS the Coder and Chris the Baboon has a ...

  7. Codeforces Round #369 (Div. 2) C. Coloring Trees(dp)

    Coloring Trees Problem Description: ZS the Coder and Chris the Baboon has arrived at Udayland! They ...

  8. Codeforces Round #436 (Div. 2) C. Bus

    http://codeforces.com/contest/864/problem/C 题意: 坐标轴上有x = 0和 x = a两点,汽车从0到a之后掉头返回,从a到0之后又掉头驶向a...从0到a ...

  9. Codeforces Round #369 (Div. 2) C. Coloring Trees(简单dp)

    题目:https://codeforces.com/problemset/problem/711/C 题意:给你n,m,k,代表n个数的序列,有m种颜色可以涂,0代表未涂颜色,其他代表已经涂好了,连着 ...

随机推荐

  1. [译]10-Spring BeanPostProcessor

    Spring框架提供了BeanPostProcessor接口,该接口暴露了两个方法postProcessBeforeInitialization(Object bean,String beanName ...

  2. diskimage-builder element

    root阶段 创建或修改初始根文件系统内容. 这是添加替代分销支持的地方,还是建立在现有图像上的自定义. 只有一个元素可以一次使用它,除非特别注意不要盲目覆盖,而是适应其他元素提取的上下文. -cac ...

  3. 【已解决】UBuntu16.04软件中心更新后只有桌面

    出现问题之前 安装好系统之后,成功启动系统,根据软件中心提示,升级电脑安装的软件,如下图所示.点击install(安装)开始更新,之后无任何提示,其实这个时候已经出现了升级异常. 呈现问题 操作步骤一 ...

  4. mysql中查询常用的关键字

    最简单的查询: 1 select * from [where ] 1 select column1,column2....from [where] 这里需要注意的是where子句中条件过滤使用到的关键 ...

  5. HDU 4474 Yet Another Multiple Problem ( BFS + 同余剪枝 )

    没什么巧办法,直接搜就行. 用余数作为每个节点的哈希值. #include <cstdio> #include <cstring> #include <cstdlib&g ...

  6. struct&&class 空的大小

    #include using namespace std; class ClassA { }; class ClassB { private: int b; }; class ClassC : pub ...

  7. favicon.ico generator

    favicon.ico generator https://www.favicon-generator.org/ https://www.favicon.cc/ https://www.favicon ...

  8. 【bzoj4378】[POI2015]Logistyka 离散化+树状数组

    题目描述 维护一个长度为n的序列,一开始都是0,支持以下两种操作:1.U k a 将序列中第k个数修改为a.2.Z c s 在这个序列上,每次选出c个正数,并将它们都减去1,询问能否进行s次操作.每次 ...

  9. vi - vim的一些遗忘点

    1. vi 供分为三种模式:一般模式.编辑模式和命令行模式.i / Esc + :wq :q :q! 使vi在一般模式与编辑模式中来回转换. /word 向下寻找一个名称为word的字符串: ?wor ...

  10. [bzoj3456] 城市规划 [递推+多项式求逆]

    题面 bzoj权限题面 离线题面 思路 orz Miskcoo ! 先考虑怎么算这个图的数量 设$f(i)$表示$i$个点的联通有标号无向图个数,$g(i)$表示$n$个点的有标号无向图个数(可以不连 ...