当前位置:网站首页>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;
}
边栏推荐
- 牙齿干细胞的存储问题(未完待续)
- 安装mongodb数据库
- When we talk about immutable infrastructure, what are we talking about
- MySQL performance_ Schema common performance diagnosis query
- Understand the deserialization principle of fastjson for generics
- JVM监控及诊断工具-命令行篇
- 你不知道的互联网公司招聘黑话大全
- Solve pod install error: FFI is an incompatible architecture
- 对称的二叉树【树的遍历】
- 每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
猜你喜欢
Ideas of high concurrency and high traffic seckill scheme
Jmeter自带函数不够用?不如自己动手开发一个
Mac version PHP installed Xdebug environment (M1 version)
Chain storage of stack
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
生活中的开销,怎么记账合适
「解析」FocalLoss 解决数据不平衡问题
C note 13
3531. 哈夫曼树
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]
随机推荐
安装VMmare时候提示hyper-v / device defender 侧通道安全性
win系统下安装redis以及windows扩展方法
「解析」FocalLoss 解决数据不平衡问题
谷歌 Chrome 浏览器发布 103.0.5060.114 补丁修复 0-day 漏洞
Crudini 配置文件编辑工具
Introduction to yarn (one article is enough)
【SQL实战】一条SQL统计全国各地疫情分布情况
3531. Huffman tree
JVM monitoring and diagnostic tools - command line
Chain storage of stack
If you don't know these four caching modes, dare you say you understand caching?
软件测试的几个关键步骤,你需要知道
可极大提升编程思想与能力的书有哪些?
牛客小白月赛52 E.分组求对数和(二分&容斥)
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]
rt-thread 中对 hardfault 的处理
Check Point:企业部署零信任网络(ZTNA)的核心要素
ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用shap决策图结合LightGBM模型实现异常值检测案例之详细攻略
JVM命令之 jstack:打印JVM中线程快照
The solution of a simple algebraic problem