HDU 多校1.7
Function
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
from 0
to n−1
and a permutation b
from 0
to m−1
.
Define that the domain of function f
is the set of integers from 0
to n−1
, and the range of it is the set of integers from 0
to m−1
.
Please calculate the quantity of different functions f
satisfying that f(i)=bf(a
i
)
for each i
from 0
to n−1
.
Two functions are different if and only if there exists at least one integer from 0
to n−1
mapped into different integers in these two functions.
The answer may be too large, so please output it in modulo 109
+7
.
For each case:
The first line contains two numbers n,
m
. (1≤n≤100000,1≤m≤100000)
The second line contains n
numbers, ranged from 0
to n−1
, the i
-th number of which represents ai−1
.
The third line contains m
numbers, ranged from 0
to m−1
, the i
-th number of which represents bi−1
.
It is guaranteed that ∑n≤106
,
∑m≤106
.
: y
indicates the case number starting from 1
and y
denotes the answer of corresponding case.
1 0 2
0 1
3 4
2 0 1
0 2 3 1
Case #2: 4
HDU 多校1.7的更多相关文章
- 2018 HDU多校第四场赛后补题
2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...
- 2018 HDU多校第三场赛后补题
2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...
- 2015 HDU 多校联赛 5363 Key Set
2015 HDU 多校联赛 5363 Key Set 题目: http://acm.hdu.edu.cn/showproblem.php? pid=5363 依据前面给出的样例,得出求解公式 fn = ...
- 2015 HDU 多校联赛 5317 RGCDQ 筛法求解
2015 HDU 多校联赛 5317 RGCDQ 筛法求解 题目 http://acm.hdu.edu.cn/showproblem.php? pid=5317 本题的数据量非常大,測试样例多.数据 ...
- [HDU多校]Ridiculous Netizens
[HDU多校]Ridiculous Netizens 点分治 分成两个部分:对某一点P,连通块经过P或不经过P. 经过P采用树形依赖背包 不经过P的部分递归计算 树型依赖背包 v点必须由其父亲u点转移 ...
- 【杂题总汇】HDU多校赛第十场 Videos
[HDU2018多校赛第十场]Videos 最后一场比赛也结束了…… +HDU传送门+ ◇ 题目 <简要翻译> 有n个人以及m部电影,每个人都有一个快乐值.每场电影都有它的开始.结束时间和 ...
- hdu多校1002 Balanced Sequence
Balanced Sequence Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s) ...
- HDU多校(Distinct Values)
Problem Description Chiaki has an array of n positive integers. You are told some facts about the ar ...
- hdu多校6
这个场要恶心死我了.. 1001 积分题,不要四舍五入 //#pragma comment(linker, "/stack:200000000") //#pragma GCC op ...
- hdu 多校第一场
1001 思路:打表可以发现只有3|n 和 4|n 的情况有解,判一下就好啦. #include<bits/stdc++.h> #define LL long long #define f ...
随机推荐
- BZOJ4321 queue2(动态规划)
考虑套路地将1~n依次加入排列.设f[i][j]为已将1~i加入排列,有j对不合法的方案数.加入i+1时可能减少一对不合法的,可能不变,可能增加一对,对于i+1与i的关系再增设0/1/2状态表示i与左 ...
- [bzoj1062] [NOI2008]糖果雨
Description 有一个美丽的童话:在天空的尽头有一个" 糖果国" ,这里大到摩天大厦,小到小花小草都是用糖果建造而成的.更加神奇的是,天空中飘满了五颜六色的糖果云,很快糖果 ...
- 自定义toolbar教程
1.写toolbar的布局文件 ,toolbar.xml <?xml version="1.0" encoding="utf-8"?> <Re ...
- 最小k度最小生成树模板
代码是抄的 题解是瞄的 可我想学习的心是真的嘤嘤嘤 然而 还是上传一份ioi大神的论文吧 链接:https://pan.baidu.com/s/1neIW9QeZEa0hXsUqJTjmeQ 密码:b ...
- js中连写两个?:三元运算符语法解释
在angular 源码中有连写两个三元运算符的代码: var hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() :$loc ...
- 用angular.element实现jquery的一些功能的简单示例
下面实现了在每个p元素后面自动添加hello world. 在这里我要说的是jquery中的 $document.ready()相当于angualr 中的angualr.element(documen ...
- Error in deleting blocks.
2014-08-24 22:15:21,714 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Error processing datan ...
- PHP 扒一扒这些题目都考了哪些知识点
1.模除 题目: <?php echo -10%3; *结果* -1 分析:其实这道题的知识点是在考模除和正负号的关系,那么我们看一段进阶的代码 <?php echo "10%3 ...
- java消息中间件入门
消息中间件来解耦服务调用 比如1个登录系统,登录的话需要调用很多系统的其他服务,如果中间调用失败,可能会导致登录信息一致无法返回,同时也增加了系统的耦合度.而用消息中间件的话,则是不发送服务到其他系统 ...
- codevs3160 最长公共子串
传送门:http://codevs.cn/problem/3160/ [题解] CTSC前复习模板 sa的模板..记住基数排序就够了(还有height) 还有就是sa[i]表示排名为i的后缀是啥..r ...