6615: Snuke Festival

时间限制: 1 Sec  内存限制: 128 MB
提交: 908  解决: 203
[提交] [状态] [讨论版] [命题人:admin]

题目描述

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.

样例输入

2
1 5
2 4
3 6

样例输出

3

提示

The following three altars can be built:
Upper: 1-st part, Middle: 1-st part, Lower: 1-st part
Upper: 1-st part, Middle: 1-st part, Lower: 2-nd part
Upper: 1-st part, Middle: 2-nd part, Lower: 2-nd part

来源/分类

ABC077&ARC084

小结:小结啥。。。这题我现在都有意见最后一句话总干画蛇添足。。。影响我的判断。。

题意:就是给三组数要求第一组比第二组小,第二组比第三组小问有多少种解决方式。。。这题最后一句话我总觉得是如果数一样就算一种啊好奇怪都理解成下标不同就可以,去重后检查了n遍输了n组示例都没找到hack点。。。最后一问结果说下标不同????没啥可说的 枚举中间的数,二分查找。复习一下lower_bound跟upper_bound

lower_bound:有序数列查找到第一个大于等于的数

upper_bound:有序数列查找到第一个大于的数

复杂度:nlogn

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define IO ios::sync_with_stdio(false),cin.tie(0)
#define FIN freopen("D://code//in.txt", "r", stdin)
#define ppr(i,x,n) for(int i = x;i <= n;i++)
#define rpp(i,n,x) for(int i = n;i >= x;i--)
const double eps = 1e-6;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;inline int read() {//读入挂int ret = 0, c, f = 1;for(c = getchar(); !(isdigit(c) || c == '-'); c = getchar());if(c == '-') f = -1, c = getchar();for(; isdigit(c); c = getchar()) ret = ret * 10 + c - '0';if(f < 0) ret = -ret;return ret;
}
ll a[maxn],b[maxn],c[maxn];
set <ll> C;
int main()
{ll n;ll ans = 0;scanf("%lld",&n);ppr(i,1,n){scanf("%lld",a+i);}ppr(i,1,n){scanf("%lld",b+i);}ppr(i,1,n){scanf("%lld",c+i);}sort(a+1,a+1+n);sort(b+1,b+1+n);sort(c+1,c+1+n);ppr(i,1,n){ll x = lower_bound(a+1,a+1+n,b[i]) - a;ll y = upper_bound(c+1,c+1+n,b[i]) - c;x--;y--;y = n-y;ans += x*y;}printf("%lld\n",ans);return 0;} 

UPC6615: 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. CODE FESTIVAL 2017 qual B

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

  4. BZOJ 2788[Poi2012]Festival

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

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

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

  6. 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 ...

  7. 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],求 ...

  8. C. The Sports Festival

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

  9. AtCoder Regular Contest 061 E - Snuke‘s Subway Trip(建图 + dijkstra最短路 / 0/1bfs / 并查集)

    AtCoder Regular Contest 061 E - Snuke's Subway Trip problem 洛谷翻译 my idea 最近一直在做网络流,所以一读这题后,我就想到了最小费用 ...

  10. GYM 101908F - Music Festival

    GYM 101908F - Music Festival 做法:将节目按照右端点排序,\(dp[i][st][0/1]\)表示前i个节目,选择的stage的状态用一个n位二进制数表示为st,第i个节目 ...

最新文章

  1. 具有absolute、relative、fixed的div设置宽度和高度的效果
  2. 链表--只知道当前节点指针删除当前节点
  3. 一个简单的登录页面,效果不错哦!
  4. linux日常管理3
  5. Tornado 使用手册(一)---------- 简单的tornado配置
  6. 如何在SAP WebClient UI里使用HANA Live report
  7. 类的构造器-init和new
  8. (转)淘淘商城系列——分布式文件系统FastDFS
  9. [置顶] SPL讲解(6)--Condition篇
  10. Google Plugin for Eclipse离线下载及安装
  11. SPSS异常值处理(图文+数据集)【SPSS 010期】
  12. 诛仙服务器技能修改,诛仙私服422服务端个人修改版带补丁+虚拟机+教程+工具[模板源码]...
  13. Delphi用QJSON解析JSON格式的数据 【转】
  14. CAD 部分快捷键注释
  15. 数字钟Matlab仿真,简单数字钟仿真电路图大全(五款数字钟仿真电路图) - 全文...
  16. python3 接入IOS推送apn
  17. [n年以前的诗] 怀念中XXXX年5月的泰山二首
  18. Painter X Liquid Ink(液体墨水)画笔
  19. 微服务项目后台技术栈
  20. git出现error: invalid object for ‘xxxxx‘

热门文章

  1. python包导入细节
  2. 移动硬盘不在计算机显示,移动硬盘在电脑上不显示怎么办
  3. html自定义属性jquery怎么拿到,jquery 获取自定义属性(attr和prop)的实现代码
  4. 计算机软件师社会需求,java软件工程师的社会环境如何?
  5. 三星手机开发游戏工具 提升游戏体验
  6. java 选股源码,珍藏多年的「高成功率」选股器分享(附源码)
  7. UTF-8编码占几个字节?
  8. php 模板 {{}},PHP模板技术
  9. 禁止java自动更新_修改注册表彻底关闭Java自动更新
  10. 【第二周】吴恩达团队AI for Medical Diagnosis大作业