CodeForces 90B African Crossword【模拟】
来源:互联网 发布:12864与单片机仿真 编辑:程序博客网 时间:2024/06/07 02:25
Description
An African crossword is a rectangular table n × m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.
To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a letter should only be crossed out if and only if the corresponding column or row contains at least one more letter that is exactly the same. Besides, all such letters are crossed out simultaneously.
When all repeated letters have been crossed out, we should write the remaining letters in a string. The letters that occupy a higher position follow before the letters that occupy a lower position. If the letters are located in one row, then the letter to the left goes first. The resulting word is the answer to the problem.
You are suggested to solve an African crossword and print the word encrypted there.
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 100). Next n lines contain m lowercase Latin letters each. That is the crossword grid.
Output
Print the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.
Sample Input
3 3cbabcdcbc
abcd
5 5fcofdooedoafaoardcdfeofsf
codeforces
#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<climits>#include<string>#include<queue>#include<stack>#include<set>#include<map>#include<algorithm>using namespace std;#define rep(i,j,k)for(i=j;i<k;i++)#define per(i,j,k)for(i=j;i>k;i--)#define MS(x,y)memset(x,y,sizeof(x))#define max(a,b) a>b?a:b#define min(a,b) a<b?a:b#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1typedef long long LL;const int INF=0x7ffffff;#define lson rt<<1, l, m#define rson rt<<1|1, m+1, rconst int M=100+1;char mp[M][M];int flag[M][M];int i,j,k,n,m;void cheak(int nn,int mm){ for(int k=nn+1;k<n;k++){ if(mp[k][mm]==mp[nn][mm]) flag[k][mm]++,flag[nn][mm]++; } for(int k=mm+1;k<m;k++){ if(mp[nn][k]==mp[nn][mm]) flag[nn][k]++,flag[nn][mm]++; } return ;}int main(){ scanf("%d%d",&n,&m); MS(flag,0); for(int i=0;i<n;i++) scanf("%s",mp[i]); for(int i=0;i<n;i++) for(int j=0;j<m;j++){ cheak(i,j); } for(i=0;i<n;i++) for(j=0;j<m;j++) if(!flag[i][j])printf("%c",mp[i][j]); printf("\n"); return 0;}
- CodeForces 90B African Crossword【模拟】
- Codeforces 90B-African Crossword
- Codeforces Beta Round #74 (Div. 2) / 90B African Crossword (模拟)
- codeforces 822 B Crossword solving
- CodeForces 822B Crossword solving
- Codeforces 822B Crossword solving
- 沐枫NOI 30. African Crossword
- codeforces 822B(Crossword solving) Java
- Codeforces Round #422 B. Crossword solving
- codeforces 822-B. Crossword solving(vector)
- Codeforces Round #422 (Div. 2) B. Crossword solving
- Codeforces Round #422 (Div. 2) B. Crossword solving
- CodeForces 451B 模拟
- Codeforces 711B 【模拟】
- 模拟-CodeForces 370B
- CodeForces 644B【模拟】
- Codeforces 745B (模拟)
- codeforces 676b 模拟
- C语言实现:复制输入字符,且有多个连续空格时只输出一个
- 30. Substring with Concatenation of All Words
- Unity整理内容方便初学者查看(第三篇_刚体,碰撞及射线)
- 生成器(Builder)
- 软件开发工具锦集(持续更新中)
- CodeForces 90B African Crossword【模拟】
- 从c++到c#转换中的一些不同
- P1094 纪念品分组
- 汉诺塔相关,递归(新汉诺塔问题,uva 10795)
- springMVC 用超链接做国际化
- reset.css文件
- yum-crond 是用于自动更新的包
- linux内核源码总览之六--------net目录
- UVA 120 煎饼