当前位置:网站首页>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;
}
边栏推荐
- Party A's requirements for those who have lost 800 yuan
- VScode进行代码补全
- k8s运行oracle
- 绕过open_basedir
- JVM命令之 jstat:查看JVM统计信息
- [FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
- Say sqlyog deceived me!
- CloudCompare-点对选取
- PTA ladder game exercise set l2-002 linked list de duplication
- Storage of dental stem cells (to be continued)
猜你喜欢

Jstat of JVM command: View JVM statistics

window下面如何安装swoole

JVM monitoring and diagnostic tools - command line

基于ADAU1452的DSP及DAC音频失真分析

Jstat pour la commande JVM: voir les statistiques JVM

开发者别错过!飞桨黑客马拉松第三期链桨赛道报名开启

Deep clustering: joint optimization of depth representation learning and clustering

SubGHz, LoRaWAN, NB-IoT, 物联网

软件测试的几个关键步骤,你需要知道

@pathvariable 和 @Requestparam的详细区别
随机推荐
Ideas of high concurrency and high traffic seckill scheme
【GNN】图解GNN: A gentle introduction(含视频)
Apple CMS V10 template /mxone Pro adaptive film and television website template
改变ui组件原有样式
C note 13
生活中的开销,怎么记账合适
老板总问我进展,是不信任我吗?(你觉得呢)
@Detailed differences between pathvariable and @requestparam
解决pod install报错:ffi is an incompatible architecture
Check point: the core element for enterprises to deploy zero trust network (ztna)
[InstallShield] Introduction
如果不知道这4种缓存模式,敢说懂缓存吗?
深度聚类:将深度表示学习和聚类联合优化
Party A's requirements for those who have lost 800 yuan
ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用shap决策图结合LightGBM模型实现异常值检测案例之详细攻略
vim映射大K
基于FPGA的VGA协议实现
The boss always asks me about my progress. Don't you trust me? (what do you think)
yarn入门(一篇就够了)
Jcmd of JVM command: multifunctional command line