当前位置:网站首页>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;
}
边栏推荐
- Real time tracking of bug handling progress of the project through metersphere and dataease
- Regular expression series of mobile phone numbers
- Flume theory
- Oracle保留字查询
- Nutch2.1分布式抓取
- 4-1 port scanning technology
- fastadmin后台设置单选按钮
- 软件工程—原理、方法与应用
- Etcd database source code analysis - put process of server
- mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
猜你喜欢

文件包含漏洞

lock4j--分布式锁中间件--自定义获取锁失败的逻辑

Configuration du Flume 4 - source personnalisée + sink

3-2 host discovery - layer 3 discovery

Detailed description of gaussdb (DWS) complex and diverse resource load management methods

Flume配置4——自定義Source+Sink

Flume configuration 1 - basic case

【Try to Hack】vulnhub narak

Linux Installation mysql5

Flutter calls Baidu map app to realize location search and route planning
随机推荐
苹果iPhone手机升级系统内存空间变小不够如何解决?
lock4j--分布式锁中间件--自定义获取锁失败的逻辑
Codeforces Global Round 21 C D E
MySQL remote connection
[network orientation training] - Enterprise Park Network Design - [had done]
Finally, Amazon~
如何设置 Pod 到指定节点运行
【精品】pinia详解
数据链路层
【剑指Offer】51. 数组中的逆序对
[boutique] detailed explanation of Pinia
Notepad++--宏(记录操作过程)
攻防演练中的防守基石——全方位监控
SSH command and instructions
画虎国手孟祥顺数字藏品限量发售,随赠虎年茅台
Foxit software was invited to appear at the 2022 advanced manufacturing digital intelligence development forum
Bigder:自动化测试工程师
剑指 Offer 59 - I. 滑动窗口的最大值
There is no small green triangle on the method in idea
社区访谈丨一个IT新人眼中的JumpServer开源堡垒机