当前位置:网站首页>AtCoder Beginner Contest 259 E - LCM on Whiteboard
AtCoder Beginner Contest 259 E - LCM on Whiteboard
2022-07-18 23:46:00 【CTGU-Yoghurt】
Annotated release .
original text : AtCoder Beginner Contest 259 E - LCM on Whiteboard_ A blog with shallow ink breaking -CSDN Blog
#include<stdio.h>
#include<iostream>
using namespace std;
#include<string>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<cstdlib>
#include<stdlib.h>
#include<vector>
#include<queue>
using namespace std;
const int N = 2e5 + 5;
map<int, int> mp, cnt;//mp Used to store the maximum power of a number ,cnt The number used to store the maximum power
struct node {
int p, e;
};
vector<struct node> v[N];
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
int m;
cin >> m;
for (int j = 1; j <= m; j++) {
node tmp;
cin >> tmp.p >> tmp.e;
// mp[tmp.p] = max(mp[tmp.p], tmp.e);
if (mp[tmp.p] < tmp.e) {// Update the maximum power
cnt[tmp.p] = 1;// Update the number with the largest power
mp[tmp.p] = tmp.e;
}
else if (mp[tmp.p] == tmp.e) {// If there is a term that is the same as the maximum power , recorded
cnt[tmp.p] ++;
}
v[i].push_back(tmp);// Store the set of numbers
}
}
int re = 1;// be equal to 1 Because when the maximum value is the same, it is also considered as a class
for (int i = 1; i <= n; i++) {// Traverse
for (int j = 0; j < v[i].size(); j++) {// Traverse the power of each number in the set
if (mp[v[i][j].p] == v[i][j].e && cnt[v[i][j].p] == 1) // If the maximum power is equal to the number of times of the set also He is the only one who has this maximum power
{
re++;// The greatest common multiples of different categories appear
break;
}
}
}
cout << min(n,re) << "\n";
return 0;
}边栏推荐
- 应用的无状态设计
- Canadian deployer Canadian adapter image construction, deployment
- 每日一题:有效的变位词(剑指offer032)
- 星巴克不使用两阶段提交
- 10.10:VectorDraw C# VS VectorDraw WEB/Crack-VectorDraw
- Leetcode sum of two numbers
- Wechat applet_ 16. Component life cycle
- Install Apple CMS and its resource collection and page code from 0
- Common password regular expressions
- 常见密码正则表达式
猜你喜欢
随机推荐
gdb 调试技巧:定位程序卡死问题
Offer gifts in July. Buy a cloud plate and give it to the super grade Guiqi. It's only limited to 2 months. If you want to buy it, hurry up
Wechat applet_ 17. Slot
Jvm-sandbox leads to the investigation of the target service JVM Metaspace oom
Compose gradient
利用备份恢复数据库,但是没有控制文件文件如何解决
Compose 轮播图
Ngrx store state management
微信小程序_15,纯数据字段
Pytest interface automation testing framework | pytest combines secondary packaging to realize interface automation
In depth explanation of MySQL index
微信小程序_17,插槽
shell第三天小练习 通过自搭建dns服务器访问自搭建nextcloud网盘服务
Design of DHT11 temperature and humidity sensor based on stm32
搭建夜莺集群监测系统
STM32F1与STM32CubeIDE编程实例-W25Q-SPI-Flash驱动
Une seule ligne de texte dépasse l'ellipse partielle, plusieurs lignes de texte dépassent l'ellipse partielle, spécifiez plusieurs lignes
7月献礼,买云盘就送特级桂七,仅限2个月,欲购从速
Expérience de l'arbre binaire
每日一题:回文链表(剑指off027)









