当前位置:网站首页>2021 CCPC Harbin J. local minimum (thinking question)
2021 CCPC Harbin J. local minimum (thinking question)
2022-06-29 20:10:00 【GHOSTANDBREAD】
Ideas :
A number is the minimum value of its row and column , Then this number is the number to be found . To find out how many such numbers there are in the matrix . You can find the minimum value of each row and column first , If both are a[i][j], be a[i][j] Is a number to be found ,res++
Code :
#include<iostream>
#include<cstring>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int a[1005][1005];
int h[1005], l[1005];
int res;
int main() {
int n, m;
scanf("%d%d", &n, &m);
memset(h, 0x3f, sizeof h);
memset(l, 0x3f, sizeof l);
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) {
scanf("%d", &a[i][j]);
if(h[i] > a[i][j]) h[i] = a[i][j];
if(l[j] > a[i][j]) l[j] = a[i][j];
}
}
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) {
if(a[i][j] == h[i] && a[i][j] == l[j])
res ++;
}
}
cout << res;
return 0;
}
边栏推荐
- 【Try to Hack】vulnhub narak
- 从众伤害的是自己
- Linux Installation mysql5
- 画虎国手孟祥顺数字藏品限量发售,随赠虎年茅台
- Notepad++--宏(记录操作过程)
- 雪花id,分布式唯一id
- Foxit software was invited to appear at the 2022 advanced manufacturing digital intelligence development forum
- Notepad++ -- macro (record operation process)
- 文件包含漏洞
- 通过MeterSphere和DataEase实现项目Bug处理进展实时跟进
猜你喜欢

文件包含漏洞

童年经典蓝精灵之百变蓝爸爸数字藏品中奖名单公布

ETCD数据库源码分析——服务端PUT流程

4-1 port scanning technology

Hangfire details

JMeter BeanShell explanation and thread calling

Luoqingqi: has high-end household appliances become a red sea? Casati took the lead in breaking the game
![[compilation principle] type check](/img/fc/458871e2df4e0384f65e09faa909d7.png)
[compilation principle] type check

liunx指令

ASP. Net core creates razor page and uploads multiple files (buffer mode) (Continued)
随机推荐
使用Gunicorn部署web.py应用
SSH命令及使用说明
剑指 Offer 59 - II. 队列的最大值
Proxmox cluster node crash handling
The list of winners in the classic Smurfs of childhood: bluedad's digital collection was announced
Chapter II (physical layer)
Nutch2.1在Windows平台上使用Eclipse debug 存储在MySQL的搭建过程
lock4j--分布式锁中间件--自定义获取锁失败的逻辑
4-1 port scanning technology
Sword finger offer 66 Building a product array
CorelDRAW最新24.1.0.360版本更新介绍讲解
雪花id,分布式唯一id
Oracle保留字查询
La collection numérique Meng xiangshun, artiste national du tigre peint, est disponible en quantité limitée et est offerte avec Maotai de l'année du tigre
.NetCore统一认证授权学习——第一次授权(2)
深入Go底层原理,重写Redis中间件实战无密
2021 CCPC 哈尔滨 J. Local Minimum (思维题)
Freemaker template framework generates images
Dynamics CRM: 本地部署的服务器中, Sandbox, Unzip, VSS, Asynchronous还有Monitor服务的作用
go: 如何编写一个正确的udp服务端