2017 ACM-ICPC 亚洲区(西安赛区)网络赛

A
There is a tree with nn nodes, at which attach a binary 64*6464∗64 matrix M_i (1 \le i \le n)M
i
(1≤i≤n). There are qq queries for matrix multiplication on the path from node aa to node bb modulo 22. To avoid massive input dataset, M_i(1\le i \le n)M
i
(1≤i≤n) is attained by the following algorithm:
Input a random seedseed (unsigned long long)
1
for(int i = 1; i <= n; ++i) {
2
for(int p = 1; p <= 64; ++p) {
3
seed ^= seed * seed + 15;
4
for(int q = 1; q <= 64; ++q) {
5
M[i][p][q] = (seed >> (q - 1)) & 1;
6
}
7
}
8
}
To avoid massive output, you should output
\displaystyle (\displaystyle \sum_{i=1}^{64} \sum_{j=1}^{64} M_{ij}19^i26^j) \mod 19260817(
i=1
∑
64
j=1
∑
64
M
ij
∗19
i
∗26
j
)mod19260817
Input Format
There are multi datasets. (\sum n \le 3000, \sum q \le 30000)(∑n≤3000,∑q≤30000).
For each dataset:
In the first n-1n−1 lines, there are to integers u,vu,v, indicates there is an edge connects node uu and node vv.(1\le u,v \le n)(1≤u,v≤n).
In the next line there is an integer seed(0 \le seed < 2^{64})seed(0≤seed<2
64
).
In the next qq lines, there is to integers a,ba,b, indicates a query on path from node aa to node bb.(1 \le a,b \le n)(1≤a,b≤n).
Output Format
For each query, output an integer in one line without any additional space.
样例输入
6 5
4 1
3 4
6 4
5 3
2 3
19260817
4 5
5 6
4 4
2 1
2 2
样例输出
4855239
2667906
277543
14478924
1173682
B
Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face up is \frac{q}{p}(\frac{q}{p} \le \frac{1}{2})
p
q
(
p
q
≤
2
1
).
The question is, when Bob tosses the coin kk times, what's the probability that the frequency of the coin facing up is even number.
If the answer is \frac{X}{Y}
Y
X
, because the answer could be extremely large, you only need to print (X * Y^{-1}) \mod (10^9+7)(X∗Y
−1
)mod(10
9
+7).
Input Format
First line an integer TT, indicates the number of test cases (T \le 100T≤100).
Then Each line has 33 integer p,q,k(1\le p,q,k \le 10^7)p,q,k(1≤p,q,k≤10
7
) indicates the i-th test case.
Output Format
For each test case, print an integer in a single line indicates the answer.
样例输入
2
2 1 1
3 1 2
样例输出
500000004
555555560
C
Define the function S(x)S(x) for xx is a positive integer. S(x)S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer kk that S(k*x)%233=0S(k∗x)%233=0.
Input Format
First line an integer TT, indicates the number of test cases (T \le 100T≤100). Then Each line has a single integer x(1 \le x \le 1000000)x(1≤x≤1000000) indicates i-th test case.
Output Format
For each test case, print an integer in a single line indicates the answer. The length of the answer should not exceed 20002000. If there are more than one answer, output anyone is ok.
样例输入
1
1
样例输出
89999999999999999999999999
D
Player #0 and Player #1 are playing a game, and they move by turns. Given nn strings, all of which only consist of the characters 00 and 11. When in Player #i's move (i = 0, 1), he has to select a character i in any of the nn strings, and remove it and all the characters on its right side. Anyone who can't move loses and the other one wins.
They find the game fairly easy after playing a while, so they make a tiny change to the original game. Besides the characters 00 and 11, now each string may contain at most one pair of parentheses, denoting that the substring between the parentheses is compressed, which occurs actually infinite times. You need to figure out who will be the winner at last, assuming that both players are rational enough.
Input Format
Multiple test cases(about 100 test cases).
For each test case, a integer in the first line denotes n(n \le 10)n(n≤10).
Then nn strings, S_1,S_2,\cdots,S_nS
1
,S
2
,⋯,S
n
, follow in the next n lines. |S_i| \le 50∣S
i
∣≤50.
It is guaranteed that the sum of length of strings in all test cases is no more than 1000010000.
Output Format
For each test case, if Player #i (i = 0,1)(i=0,1) wins regardless of moving first or not, print "i wins", otherwise print "tie".
Hint
Once a player selects a character between the parentheses and removes it and all the characters on its right side, the actual length of the string will decrease from infinity to a finite number, hence all the games will end in finite turns.
Taking the third sample for instance, without loss of generality, let Player #0 moves first. Let’s assume that he selects the (k+1)-th character between the parentheses, and then the string will become 0000...00000...0, whose length is kk. Afterwards Player #1 have to remove infinite 1s and make sure the number of the remaining 1s is greater than or equal to kk. Then we will see Player #1 must be the winner. According to symmetry of the initial strings, Player #0 will win if Player #1 moves first. Therefore, the game is a tie.
样例输入
2
10
0
2
0(1)
100000000000000
2
(0)
(1)
3
0(1)0
1(0)
1(0)
3
0(1)1
0(1)1
1(0)
样例输出
0 wins
1 wins
tie
tie
tie
E
Given a directed graph with nn nodes, labeled 0,1, \cdots, n-10,1,⋯,n−1.
For each <i, j><i,j> satisfies 0 \le i < j < n0≤i<j<n, there exists an edge from the i-th node to the j-th node, the capacity of which is ii xor jj.
Find the maximum flow network from the 0-th node to the (n-1)-th node, modulo 10000000071000000007.
Input Format
Multiple test cases (no more than 1000010000).
In each test case, one integer in a line denotes n(2 \le n \le 10^{18})n(2≤n≤10
18
).
Output Format
Output the maximum flow modulo 10000000071000000007 for each test case.
样例输入
2
样例输出
1
F
f(cos(x))=cos(n∗x) holds for all xx.
Given two integers nn and mm, you need to calculate the coefficient of x^mx
m
in f(x)f(x), modulo 998244353998244353.
Input Format
Multiple test cases (no more than 100100).
Each test case contains one line consisting of two integers nn and mm.
1 \le n \le 10^9,0 \le m \le 10 ^ 41≤n≤10
9
,0≤m≤10
4
.
Output Format
Output the answer in a single line for each test case.
样例输入
2 0
2 1
2 2
样例输出
998244352
0
2
G
There is a tree with nn nodes. For each node, there is an integer value a_ia
i
, (1 \le a_i \le 1,000,000,0001≤a
i
≤1,000,000,000 for 1 \le i \le n1≤i≤n). There is qq queries which are described as follow: Assume the value on the path from node aa to node bb is t_0, t_1, \cdots t_mt
0
,t
1
,⋯t
m
. You are supposed to calculate t_0t
0
xor t_kt
k
xor t_{2k}t
2k
xor ... xor t_{pk}t
pk
(pk \le m)(pk≤m).
Input Format
There are multi datasets. (\sum n \le 50,000, \sum q \le 500,000)(∑n≤50,000,∑q≤500,000).
For each dataset: In the first n-1n−1 lines, there are two integers u,vu,v, indicates there is an edge connect node uu and node vv.
In the next nn lines, There is an integer a_ia
i
(1 \le a_i \le 1,000,000,0001≤a
i
≤1,000,000,000).
In the next qq lines, There is three integers a,ba,b and kk. (1 \le a,b,k \le n1≤a,b,k≤n).
Output Format
For each query, output an integer in one line, without any additional space.
样例输入
5 6
1 5
4 1
2 1
3 2
19
26
0
8
17
5 5 1
1 3 2
3 2 1
5 4 2
3 4 4
1 4 5
样例输出
17
19
26
25
0
19
H
AI likes playing a game named "Rhythm Master".
He plays this game day after day, it is super noisy. His roommate can not tolerate him anymore, so he decide to write a plug-in to defeat AI.
We can regard this game as in an 1\times n1×n keyboard. Every millisecond, there are some note drop to some position of your keyboard. Notes have two different types.
'*': The note is a single note, you can press the corresponding button to get 55 points.
'#': The note is a continuous note, this position will be '#' for several milliseconds, only if you press the corresponding button and never get miss between the continuous note, you can get 10*P10∗P points, PP is the number of '#'.
For more, '.' means at this time there are no note drop to the position.
The word miss means, if you lose any note at millisecond TT, you will get miss at TT.
For example:
Time 11: #..*
Time 22: #...
If you press (1001) at the first millisecond(11 means pressing, 00 means no pressing), you will get 55 points, if you press (1000) at the second millisecond, you will get 10*2=2010∗2=20 points.
If you press (1000) at the first millisecond, you will get 00 points, if you press (1000) at the second millisecond, you will get 00 points, because you get miss at millisecond 11.
To make this game more interesting, the developer add a new data named combo.
If you don’t get miss at millisecond TT, you will get a combocombo, means combo=combo+1combo=combo+1;
If you get miss at millisecond TT, or the game ends, you will get \frac{combo^2}{2}+\frac{combo}{2}-1
2
combo
2
+
2
combo
−1 points and then your combo will become to 00.
For example:
Time 11: #..#
Time 22: #..#
Time 33: #...
If you press (1001),(1001),(1001) in first 33 times, you will get 30+20+3*3/2+3/2-1 = 5530+20+3∗3/2+3/2−1=55 points.
If you press (1001),(1001),(0000) in first 33 times, you will get 20+2*2/2+2/2-1 = 2220+2∗2/2+2/2−1=22 points.
If you press (1001),(0001),(1000) in first 33 times, you will get 00 point.
Now the plug-in is ready for use, but we notice it has some bugs.
If the plug-in press XX at millisecond TT, It can not press YY at millisecond T+1T+1.
For example:
X=1010, Y=0101X=1010,Y=0101.
If the plug-in press 1010(or 1110,1011,1111) at time TT, it can not press 0101 at time T+1T+1, so can’t 1101,0111, and 1111.
Help the plug-in to find the maximum points it can get.
Input Format
Several test cases.
Each case begins with 33 integers N,M,K(1\le N\le 7,1 \le M \le 5000,1 \le K \le 1000)N,M,K(1≤N≤7,1≤M≤5000,1≤K≤1000). NN is the size of keyboard. MM is the millisecond of the game. KK is the number of bug.
The next KK lines, each line contains two 01 string, means X,YX,Y.
Then MM lines follow, each line contains a string with length NN, the i-th(1 \le i \le M1≤i≤M) line means the situation of millisecond ii.
Output Format
For each test case, print an integer in a single line.
样例输入
4 4 2
1111 1111
0011 1100
****
*##
*##
..
样例输出
30
I
Barty have a computer, it can do these two things.
Add a new string to its memory, the length of this string is even.
For given 44 strings a,b,c,da,b,c,d, find out how many strings that can be product by a+s1+b+c+s2+da+s1+b+c+s2+d, and |a| + |s1| + |b| = |c| + |s2| + |d|∣a∣+∣s1∣+∣b∣=∣c∣+∣s2∣+∣d∣. |s|∣s∣ means the length of string ss, s1s1 and s2s2 can be any string, including "".
Please help your computer to do these things.
Input Format
Test cases begins with T(T \le 5)T(T≤5).
Then TT test cases follows.
Each test case begins with an integer Q(Q \le 30000)Q(Q≤30000).
Then QQ lines,
1 s: add a new string ss to its memory.
2 a b c d: find how many strings satisfying the requirement above.
\sum |s| + |a| + |b| + |c| + |d| \le 2000000∑∣s∣+∣a∣+∣b∣+∣c∣+∣d∣≤2000000.
Output Format
For type 22 query. Output the answer in one line.
样例输入
1
10
1 abcqaq
1 abcabcqaqqaq
2 ab bc qa aq
2 a c q q
1 abcabcqaqqwq
2 ab bc qa aq
2 a c q q
1 abcq
2 a c q q
2 a b c q
样例输出
1
2
1
3
3
1
G
This problem is very easy. You need to do these QQ queries.
Queries have 33 types.
1 n x1 x2 x3 , ... , xn: Add a new sequence to the next line.
2 x l1 r1 y l2 r2: Copy two sub-sequence and expend them to the next line.
3 x k: Output the first kk sum of sub-sequence of sequence in the x-th line, in increasing order of the sum of each sub-sequence.
Input Format
First line an integer T(T=6)T(T=6), indicates the number of test cases.
In each case, begin with an integer Q(Q \le 100000)Q(Q≤100000).
Then comes QQ lines.
1 n x1 x2 x3, ..., xn: means the first type.
2 x l1 r1 y l2 r2: means the second type. xx and yy is the line of the two sequences. [l1,r1][l1,r1], [l2,r2][l2,r2] are the two sub-sequences.
3 x k: means we need the first kk sum of sub-sequence of the x-th sequence in increasing order.
Sum of nn or sum of k \le 1000000k≤1000000.
Each sequence is no longer than 10000001000000.
We granted that every number you read are non-negative.
Output Format
For every query of type 33, print kk number, each number in a single line .
样例输入
1
3
1 5
1 2 3 4 5
3 1 2
3 1 4
样例输出
1
2
1
2
3
3
2017 ACM-ICPC 亚洲区(西安赛区)网络赛的更多相关文章
- HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛)
HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others) Memory Limit: ...
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 M. Frequent Subsets Problem【状态压缩】
2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 M. Frequent Subsets Problem 题意:给定N和α还有M个U={1,2,3,...N}的子集,求子集X个数,X满足:X是U ...
- 2016 ACM/ICPC亚洲区青岛站现场赛(部分题解)
摘要 本文主要列举并求解了2016 ACM/ICPC亚洲区青岛站现场赛的部分真题,着重介绍了各个题目的解题思路,结合详细的AC代码,意在熟悉青岛赛区的出题策略,以备战2018青岛站现场赛. HDU 5 ...
- ICPC 2018 徐州赛区网络赛
ACM-ICPC 2018 徐州赛区网络赛 去年博客记录过这场比赛经历:该死的水题 一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进. D. Easy Math 题意: ...
- Skiing 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛H题(拓扑序求有向图最长路)
参考博客(感谢博主):http://blog.csdn.net/yo_bc/article/details/77917288 题意: 给定一个有向无环图,求该图的最长路. 思路: 由于是有向无环图,所 ...
- [刷题]ACM/ICPC 2016北京赛站网络赛 第1题 第3题
第一次玩ACM...有点小紧张小兴奋.这题目好难啊,只是网赛就这么难...只把最简单的两题做出来了. 题目1: 代码: //#define _ACM_ #include<iostream> ...
- 2017 ACM/ICPC(西安)赛后总结
早上8:00的高铁,所以不得不6点前起床,向火车站赶……到达西安后已经是中午,西工大距离西安北站大概3小时车程的距离,只好先解决午饭再赶路了……下午3.30的热身赛,一行人在3.35左右赶到了赛场,坐 ...
- 2016 ACM/ICPC亚洲区大连站-重现赛 解题报告
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=5979 按AC顺序: I - Convex Time limit 1000 ms Memory li ...
- 2014ACM/ICPC亚洲区鞍山赛区现场赛1009Osu!
鞍山的签到题,求两点之间的距离除以时间的最大值.直接暴力过的. A - Osu! Time Limit:1000MS Memory Limit:262144KB 64bit IO Fo ...
- [刷题]ACM ICPC 2016北京赛站网络赛 D - Pick Your Players
Description You are the manager of a small soccer team. After seeing the shameless behavior of your ...
随机推荐
- 021.4 IO流——字节、字符桥梁(编码解码)
默认使用的就是gbk编码,这里的例子改成了utf8编码 写入—编码 private static void writeText() throws IOException { FileOutputStr ...
- BZOJ 1041 圆上的整点 数学
题目链接: https://www.lydsy.com/JudgeOnline/problem.php?id=1041 题目大意:求一个给定的圆(x^2+y^2=r^2),在圆周上有多少个点的坐标是整 ...
- [枫叶学院] Unity3d高级开发教程 工具集(一) 哈希列表——强大的自己定义数据集
在日常开发中.数据集合是我们不可缺少的重要工具之中的一个.在C#中,.Net Framework也为我们提供了种类繁多,功能多样的数据集工具.在此,我基于List<T> 和 HashTab ...
- ethereumjs/ethereumjs-vm-3-StateManager
https://github.com/ethereumjs/ethereumjs-vm/blob/master/docs/stateManager.md StateManager 要与本博客的ethe ...
- robotframework接口测试(二)—post request
第5行:发起post请求.因为我写了好多的参数,所以这样写的. 也可以这样写 其他行:可见[robotframework接口测试(二)—get request json]
- Linux-- 目录基本操作(2)
cp 复制文件或目录 用法:cp [OPTION] SOURCE源文件 DIRECTORY目标文件,具体可以查看 man cp 以常用的参数举例 [root@hs-192-168-33-206 tom ...
- Qt绘制动态曲线
首先*.pro文件中加一句 QT += charts 然后 mainwindow.cpp文件如下: #include "mainwindow.h" #include "u ...
- docker启动mysql
docker启动mysql docker run -p 3306:3306 -v /dockermysqlcfg/config/my.cnf:/etc/mysql/my.cnf -v /dockerm ...
- ionic ios 打包
1.安装Xcode 从appstore 安装就行 2.安装node.js 3.安装cordova 由于权限问题 网络问题 可以考虑一下方式 1️⃣使用淘宝镜像 npm install ...
- 关于json时间数据格式转换与修改
使用easyui获取JSON时间数据时间数据时,通常是一长串的数字而不是我们想要的类似2018-11-01的普通时间格式. 此时我们就需要使用到关于JSON时间的格式化,而将时间转化成我们想要的格式. ...