当前位置:网站首页>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");
}
}
边栏推荐
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
- Dachang image library
- Building the prototype of library functions -- refer to the manual of wildfire
- Day 50 - install vsftpd on ceontos6.8
- Zero basic self-study STM32 wildfire review of GPIO use absolute address to operate GPIO
- Sword finger offer 29 Print matrix clockwise
- 模板_快速排序_双指针
- Structural theme model (I) STM package workflow
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
- 【MySQL 15】Could not increase number of max_ open_ files to more than 10000 (request: 65535)
猜你喜欢

Advanced technology management - what is the physical, mental and mental strength of managers

MySQL winter vacation self-study 2022 11 (9)

Maturity of master data management (MDM)

米家、涂鸦、Hilink、智汀等生态哪家强?5大主流智能品牌分析

2022 eye health exhibition, vision rehabilitation exhibition, optometry equipment exhibition, eye care products exhibition, eye mask Exhibition
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8](/img/16/33f5623625ba817e6e022b5cb7ff5d.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17](/img/85/2635afeb2edeb0f308045edd1f3431.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17

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

2345文件粉碎,文件强力删除工具无捆绑纯净提取版

Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
随机推荐
Easy to use js script
Paper notes: limit multi label learning galaxc (temporarily stored, not finished)
Apt installation ZABBIX
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 24
Six stone management: why should leaders ignore product quality
模板_求排列逆序对_基于归并排序
Template_ Find the reverse pair of permutations_ Sort based on merge
DDoS attacks - are we really at war?
Redis cluster deployment based on redis5
Force buckle 146 LRU cache
【无标题】数据库中一条查询SQL执行的过程
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
从顶会论文看2022年推荐系统序列建模的趋势
Introduction to robotframework (II) app startup of appui automation
CobaltStrike-4.4-K8修改版安装使用教程
Building the prototype of library functions -- refer to the manual of wildfire
Pat grade a 1033 to fill or not to fill
【MySQL 15】Could not increase number of max_open_files to more than 10000 (request: 65535)
PMP practice once a day | don't get lost in the exam -7.5
Day 50 - install vsftpd on ceontos6.8