当前位置:网站首页>Elimination games
Elimination games
2022-07-06 02:39:00 【< WRM>】
#include<bits/stdc++.h>
using namespace std;
const int N = 100;
int a[N][N];
int b[N][N];// Express (i,j) Can the grid of position be deleted , Can delete marked as 1, Cannot delete marked 0
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
scanf("%d", &a[i][j]);
b[i][j] = 0;// initialization b
}
}
for(int i=1;i<=n;i++) {
for(int j=1;j<=m;j++) {
int u=i,d=i,l=j,r=j;
int x=a[i][j];
// from (i,j) Set out , Start in four directions up, down, left and right ,
// When and a[i][j] Only when the values are the same can we move forward in the current direction ,
// When the number of columns or rows is greater than or equal to 3 when , Mark a[i][j] Can be eliminated
while(u>=1&&a[u][j]==x) u--;//
while(d<=n&&a[d][j]==x) d++;
while(r<=m&&a[i][r]==x) r++;
while(l>=1&&a[i][l]==x) l--;
if(d-u-1>=3||r-l-1>=3)
{
b[i][j]=1;
}
}
}
for(int i=1;i<=n;i++) {
for(int j=1;j<=m;j++) {
if(b[i][j]) printf("%d ",0);
else printf("%d ",a[i][j]);
}
printf("\n");
}
}
边栏推荐
- 全国大学生信息安全赛创新实践赛初赛---misc(永恒的夜)
- Shell script updates stored procedure to database
- 729. My schedule I / offer II 106 Bipartite graph
- Thinking on Architecture Design (under continuous updating)
- [Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
- 2022 China eye Expo, Shandong vision prevention and control exhibition, myopia, China myopia correction Exhibition
- 故障分析 | MySQL 耗尽主机内存一例分析
- Bigder:34/100 面试感觉挺好的,没有收到录取
- 【MySQL 15】Could not increase number of max_ open_ files to more than 10000 (request: 65535)
- 【MySQL 15】Could not increase number of max_open_files to more than 10000 (request: 65535)
猜你喜欢
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12](/img/b1/926d9b3d7ce9c5104f3e81974eef07.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12

深度解析链动2+1模式,颠覆传统卖货思维?

Reset nodejs of the system

【MySQL 15】Could not increase number of max_open_files to more than 10000 (request: 65535)

Which ecology is better, such as Mi family, graffiti, hilink, zhiting, etc? Analysis of five mainstream smart brands

Gifcam v7.0 minimalist GIF animation recording tool Chinese single file version

解决:AttributeError: ‘str‘ object has no attribute ‘decode‘

A doctor's 22 years in Huawei

主数据管理理论与实践

GifCam v7.0 极简GIF动画录制工具中文单文件版
随机推荐
我把驱动换成了5.1.35,但是还是一样的错误,我现在是能连成功,但是我每做一次sql操作都会报这个
2022 eye health exhibition, vision rehabilitation exhibition, optometry equipment exhibition, eye care products exhibition, eye mask Exhibition
Sword finger offer 30 Stack containing min function
Li Kou today's question -729 My schedule I
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
Paper notes: graph neural network gat
I changed the driver to 5.1.35, but it is still the same error. I can succeed even now, but I will report this every time I do an SQL operation
Network Security Learning - Web vulnerabilities (Part 1)
Differences and usage scenarios between TCP and UDP
Universal crud interface
全国大学生信息安全赛创新实践赛初赛---misc(永恒的夜)
【MySQL 15】Could not increase number of max_open_files to more than 10000 (request: 65535)
在GBase 8c数据库中使用自带工具检查健康状态时,需要注意什么?
Sword finger offer 29 Print matrix clockwise
微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器
07 singleton mode
DDoS "fire drill" service urges companies to be prepared
好用的 JS 脚本
2022 China eye Expo, Shandong vision prevention and control exhibition, myopia, China myopia correction Exhibition