6615: Snuke Festival

题目描述

The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.
He has N parts for each of the three categories. The size of the i-th upper part is Ai, the size of the i-th middle part is Bi, and the size of the i-th lower part is Ci.
To build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.
How many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.

Constraints
1≤N≤105
1≤Ai≤109(1≤i≤N)
1≤Bi≤109(1≤i≤N)
1≤Ci≤109(1≤i≤N)
All input values are integers.

输入

Input is given from Standard Input in the following format:
N
A1 … AN
B1 … BN
C1 … CN

输出

Print the number of different altars that Ringo can build.

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;int b[100005];
int a[100005];
int c[100005];int main()
{int n;while(~scanf("%d",&n)){long long sum=0;for(int i=0;i<n;i++)scanf("%d",a+i);for(int i=0;i<n;i++)scanf("%d",b+i);for(int i=0;i<n;i++)scanf("%d",c+i);sort(a,a+n);sort(b,b+n);sort(c,c+n);int x=0,y=0,numa=0,numc=n;for(int i=0;i<n;i++){while(b[i]>a[x]&&x<n){x++;numa++;}while(b[i]>=c[y]&&y<n){y++;numc--;}sum+=(long long)numa*numc;}printf("%lld\n",sum);}return 0;
}

UPC 6615: Snuke Festival相关推荐

  1. Snuke Festival(二分法)

    题目描述 The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritu ...

  2. 搜索 —— 暴力搜索

    [暴力搜索] 暴力搜索,就是将所有情况都举出,并判断其是否符合题目条件.其基本方法是分析题意后,找到一个合适的维度列举每一个元素,以完成题目. 一般主流的 OJ 中,1000ms 的时间限制下可以运行 ...

  3. UPC第38,39,40场部分题解

    UPC第38,39,40场部分题解 第38场 A. Bovine Alliance Description Bessie and her bovine pals from nearby farms h ...

  4. CODE FESTIVAL 2017 qual B

    昨晚因为有点事就去忙了,没打后悔啊 A - XXFESTIVAL Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem ...

  5. BZOJ 2788[Poi2012]Festival

    题面: 2788: [Poi2012]Festival Time Limit: 30 Sec  Memory Limit: 64 MB Submit: 418  Solved: 190 [Submit ...

  6. UPC个人训练赛第十五场(AtCoder Grand Contest 031)

    传送门: [1]:AtCoder [2]:UPC比赛场 [3]:UPC补题场 参考资料 [1]:https://www.cnblogs.com/QLU-ACM/p/11191644.html B.Re ...

  7. CodeForces - 1509C The Sports Festival(dp)

    题目链接:点击查看 题目大意:给出一个长度为 nnn 的数列,现在需要对其进行重排列,使得贡献之和最小 对于一个排列的贡献来说,对于每个 iii ,则 di=max(a1,a2,...,ai)−min ...

  8. G. GCD Festival(莫比乌斯、欧拉函数)

    G. GCD Festival ∑i=1n∑j=1ngcd⁡(ai,aj)gcd⁡(i,j)∑d=1nd∑i=1nd∑j=1ndgcd⁡(aid,ajd)[gcd⁡(i,j)=1]∑d=1nd∑k=1 ...

  9. ARC068C - Snuke Line

    ARC068C - Snuke Line Description 其实就是给出nnn个区间[li,ri][l_i,r_i][li​,ri​]对于每一个i∈[1,M]i\in[1,M]i∈[1,M],求 ...

  10. C. The Sports Festival

    C. The Sports Festival 题意: n个数,依次将所有数加入到区间内,每次得到一个k,k等于当前区间的最大值减最小值, 求所有k的和的最小值 题解: 一开始就没往dp那方面想,自己在 ...

最新文章

  1. MYSQL修改配置,允许远程访问
  2. 浅谈使用openwave测试的几个注意项
  3. 计算机专业文档写作课件,计算机专业论文写作的方法.ppt
  4. 封装+构造方法小例子
  5. (62)时钟中断切换线程,时间片管理, KiDispatchInterrupt
  6. 基于产生式的动物识别专家系统_钇鑫智通打造“极致流畅人脸识别闸机”
  7. 祝贺|合肥.NET俱乐部第二期技术沙龙活动圆满成功
  8. springmvc中报错Request processing failed;
  9. [html] 举例说明只用html和css如何使得一个列表编号倒序?
  10. java对字符串归一化_搜索引擎中的字符串归一化 | 学步园
  11. 安卓电视盒子上 安装 Ubuntu 20.04 并安装 certbot 获取证书
  12. 迪普交换机恢复出厂设置_LSW交换机初始化配置指导
  13. 工程项目成本费用明细表_项目工程成本不会测算?全套Excel自动计算表,可直接套定额...
  14. 超级表格第21行的秘密
  15. docker: error pulling image configuration
  16. 图片去水印软件教程-图片如何在线去水印
  17. OGR遍历要素及重置
  18. 【Java入门杂记】【六】
  19. 五款数字孪生软件大比拼:优缺点分析测评报告
  20. 2021秋冬上海时装周开启,聚焦8大国内外品牌

热门文章

  1. 搜索引擎如何优化?这些方法要知道
  2. Educoder Python顺序结构习题
  3. 个人编程语言的学习感悟
  4. Sampling Hair Density Field by Deterministic Importance Sampling
  5. 计算机硬盘的文件怎么删除文件,电脑硬盘删除文件怎么恢复
  6. ROVIO安装运行及保存轨迹用evo评估
  7. 计算机检索的pdf格式,计算机检索基础.pdf
  8. 《网页配色密码》 一本易读实用的好书
  9. PyQt5_pyqtgraph股票MACD指标
  10. npm warn config global `--global`, `--local` are deprecated. use `--location=global` instead.