当前位置:网站首页>Niuke Xiaobai monthly race 52 E. sum logarithms in groups (two points & inclusion and exclusion)
Niuke Xiaobai monthly race 52 E. sum logarithms in groups (two points & inclusion and exclusion)
2022-07-07 06:18:00 【Harris-H】
Niuke Xiaobai moon race 52 E. Sum logarithms in groups ( Two points & A class )
First save all the numbers in an array , Then use two dimensions vector Save the number of each group .
According to the thought of tolerance and exclusion , For each number, first find all the satisfied numbers by dichotomy, and then subtract the number in your group .
Those in my group are corresponding vector Two points in .
Time complexity : O ( m l o g m ) O(mlogm) O(mlogm)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n, k;
vector<int> ve[1000009], a;
void solved() {
scanf("%d%d", &n, &k);
int m;
for(int i = 0; i < n; i ++) {
scanf("%d", &m);
int x;
while(m --) {
scanf("%d", &x);
ve[i].push_back(x);
a.push_back(x);
}
sort(ve[i].begin(), ve[i].end());
}
sort(a.begin(), a.end());
ll ans = 0;
for(int i = 0; i < n; i ++) {
m = ve[i].size();
for(int j = 0; j < m; j ++) {
int x = ve[i][j], y = k - x;
ans +=
(a.end() - upper_bound(a.begin(), a.end(), y - 1)) -
(ve[i].end() - upper_bound(ve[i].begin(), ve[i].end(), y - 1));
}
}
ans /= 2;
cout << ans % 998244353;
}
int main() {
// int ttx; cin >> ttx; while(ttx --)
solved();
return 0;
}
边栏推荐
- 外设驱动库开发笔记43:GPIO模拟SPI驱动
- 3531. 哈夫曼树
- Jstack of JVM command: print thread snapshots in JVM
- JVM监控及诊断工具-命令行篇
- Value range of various datetimes in SQL Server 2008
- 谷歌 Chrome 浏览器发布 103.0.5060.114 补丁修复 0-day 漏洞
- CMD permanently delete specified folders and files
- Dc-7 target
- ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用shap决策图结合LightGBM模型实现异常值检测案例之详细攻略
- 980. Different path III DFS
猜你喜欢

How to keep accounts of expenses in life

话说SQLyog欺骗了我!

Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou

ML's shap: Based on the adult census income binary prediction data set (whether the predicted annual income exceeds 50K), use the shap decision diagram combined with the lightgbm model to realize the

3428. Put apples

Jstat pour la commande JVM: voir les statistiques JVM
![A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]](/img/fd/7223d78fff54c574260ec0da5f41d5.png)
A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]

搞懂fastjson 对泛型的反序列化原理

DC-7靶机

How to set up in touch designer 2022 to solve the problem that leap motion is not recognized?
随机推荐
Jmeter自带函数不够用?不如自己动手开发一个
当我们谈论不可变基础设施时,我们在谈论什么
为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾
JVM命令之 jstat:查看JVM统计信息
计算模型 FPS
Rk3399 platform development series explanation (WiFi) 5.53, hostapd (WiFi AP mode) configuration file description
牛客小白月赛52 E.分组求对数和(二分&容斥)
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
CTFshow--常用姿势
3428. Put apples
[InstallShield] Introduction
693. 行程排序
Go语学习笔记 - gorm使用 - 原生sql、命名参数、Rows、ToSQL | Web框架Gin(九)
Jstack of JVM command: print thread snapshots in JVM
Go language learning notes - Gorm use - Gorm processing errors | web framework gin (10)
laravel 使用腾讯云 COS5全教程
安装mongodb数据库
A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]
JMeter's own functions are not enough? Why don't you develop one yourself
Peripheral driver library development notes 43: GPIO simulation SPI driver