DAY14 浙大赛暨西安站校选The 19th Zhejiang University Programming Contest Sponsored by TuSimple (Mirror)

“Brilliance”小队的第一次正式赛

就不贴代码了,把AC了的题的思路稍微提一下把。

A.Thanks, TuSimple!

Time Limit: 1 Second Memory Limit: 65536 KB
In the very first sentence of the very first problem, we would like to give our sincere thanks to TuSimple, the sponsor of this contest.

Founded in 2015, TuSimple is a global autonomous trucking solution company headquartered in San Diego, operating self-driving trucks out of Tucson, Arizona. TuSimple is now developing a commercial-ready Level 4 (SAE) fully-autonomous driving solution for the logistics industry. TuSimple’s trucks are the first and only capable of self-driving from depot-to-depot and do so every day for its customers. The company is driven by a mission to increase safety, decrease transportation costs, and reduce carbon emissions.

Nowadays, the trucking industry is currently facing a shortage of 50000 drivers (which is expected to increase to 175000 by the end of 2024) and is approaching a 100 percent turnover rate per year with an average driver age of 49 years old. According to a PwC study, autonomous trucking technologies will reduce annual operating costs for a traditional average long-haul truck by 28 percent in 2025. TuSimple is aiming to transform the 740-billion U.S. trucking industry by cutting costs, reducing carbon emissions and eradicating some of the challenges currently faced by operators.

Building the industry’s first 1000-meter perception system, TuSimple soon becomes the pioneer in the industry. As is known to us, 1000 meters can provide 35 seconds of reaction time on average at highway speeds, enabling the system to make the safest and most efficient driving decisions. Even in the adverse weather conditions, the perception system is still designed to identify objects and obstacles, ensuring the safety of both cargoes, trucks, and passers-by. On the other hand, TuSimple’s latest proprietary AI is now capable of long-distance highway driving and complex surface street driving, which allows fully autonomous deliveries from one depot to another.

Despite their advanced technology and an enormous sense of mission in the industry, TuSimple shares the corporate culture of honesty, realistic, exploration and innovation among their employees from bottom to top, which allows them to attract more and more elites from all expertise to join and get involved. “Here’s why a little-known autonomous trucking company is beating Tesla and Waymo in the race for driverless big rigs”, commented by Business Insider.

The future of trucking is now!
As a manager of TuSimple, you are going to hold a dancing party for both the Development Department and the Marketing Department. There will be gentlemen and ladies in total and they are going to dance in pairs. After a careful investigation, we have already known that for each person, they like to dance with either a taller person or a person with smaller height. To simplify the problem, there are no two persons of the same height and people are only allowed to dance with a person of the opposite gender. In order to reserve a proper dancing field, you must calculate the maximum possible number of pairs of people dancing at the same time.

Input
There are multiple test cases. The first line of the input contains an integer , indicating the number of test cases. For each test case:

The first line contains two integers (), indicating the number of gentlemen and ladies.

The second line contains integers (, for all ), indicating the height of each gentleman.

The third line contains integers (, for all ), indicating the height of each lady.

The fourth line contains integers (), indicating the preference of each gentleman. If , it means gentleman prefers to dance with a lady of smaller height. Otherwise it indicates he prefers to have a taller dancing partner.

The fifth line contains integers (), indicating the preference of each lady. If , it means lady prefers to dance with a gentleman of smaller height. Otherwise it indicates she prefers to have a taller dancing partner.

It’s guaranteed that the sum of and of all test cases will not exceed and for all .

Output
For each test case output one line containing one integer, indicating the answer.

Sample Input
1
3 3
1 2 5
3 4 6
1 1 0
0 0 1
Sample Output
2
Hint
In the sample test case, the 1st gentleman can dance with the 2nd lady, and the 2nd gentleman can dance with the 1st lady.

题意&思路

舞会配对,男的只能和女的跳,有人想和高的,有人想和矮的,求最多能满足的配对数。

贪心,扫两遍。

B.Even Number Theory

Time Limit: 1 Second Memory Limit: 65536 KB
Let , which is the set of all positive even numbers. Define the following concepts:

E-prime: A positive even number is an e-prime, if and only if there does not exist two integers and , such that and . For example, 2 and 18 are e-primes, but 16 is not, as .

E-prime factorization: An e-prime factorization of a positive even number is the decomposition of into the product of some smaller e-primes.

More formally, an e-prime factorization of a positive even number is a \textbf{multiset} (a set which allows duplicated elements) such that

For all , is an e-prime;
.
Please note that, different from the traditional number theory, the e-prime factorization of a positive even number is NOT unique. For example, we can factorize 36 into or .

E-factorial: Let be the e-factorial of a positive even number , we have
For example, .

Given a positive even number , your task is to find an e-prime factorization of , such that (the size of ) is as large as possible. In order to make the task easier, you just need to output the value of .

Input
There are multiple test cases. The first line of the input contains an integer (about 50), indicating the number of test cases. For each test case:

The first and only line contains a positive even number (), indicating the given number.

Output
For each test case output one integer in one line, indicating the maximum size of the e-prime factorization of .

Sample Input
2
2
4
Sample Output
1
3
Hint
For the first sample test case, as 2!! = 2 is an e-prime, the answer is (obviously) 1.

For the second sample test case, we can factorize 4!! = 8 into , which contains 3 e-primes.

题意&思路

介绍了一种数的新分解方法。
队友想出的思路,先多算几个,可以发现就是不断除去2,考虑到数据范围,用高精度除法。

E.Potion

Time Limit: 1 Second Memory Limit: 65536 KB
BaoBao is brewing a magical potion. To brew this potion, types of ingredients, whose rank ranges from 1 to , is needed. More precisely, for all , BaoBao needs at least pieces of rank- ingredients to make the potion, while he only has pieces of these ingredients in his storeroom.

Fortunately, BaoBao is able to downgrade a higher rank ingredient to a lower rank one (this operation can be performed any number of times, including zero time). Is it possible that BaoBao can make the potion using the ingredients in his storeroom?

Input
There are multiple test cases. The first line of the input contains an integer (about 100), indicating the number of test cases. For each test case:

The first line contains an integer (), indicating the number of types of ingredients.

The second line contains integers (), where indicates the number of rank- ingredients needed.

The third line contains integers (), where indicates the number of rank- ingredients BaoBao has in his storeroom.

Output
For each test case output one line. If BaoBao is able to brew the potion, output “Yes” (without quotes), otherwise output “No” (without quotes).

Sample Input
2
3
3 3 1
1 2 5
3
3 1 2
5 2 1
Sample Output
Yes
No
Hint
For the first sample test case, BaoBao can downgrade one rank-3 ingredient to a rank-2 ingredient, and downgrade two rank-3 ingredients to two rank-1 ingredients.

题意&思路

要合成一剂药,有不同成分,高级成分可以代替低级成分。
开个数组,从高级往低级扫一遍,签到题。

G.Postman

Time Limit: 1 Second Memory Limit: 65536 KB
letters have just arrived at the post office positioned at , and the -th letter should be posted to position . BaoBao, our beloved postman, will start his work from the post office and deliver all these letters by himself.

Unfortunately, BaoBao’s backpack can only hold at most letters each time (which means that if he wants to deliver some letter not in his backpack, he will have to go back to the post office and fetch it), so he may not be able to deliver all letters in one go. Please note that BaoBao cannot temporarily drop a letter outside the post office and pick it back afterward.

What’s the minimum distance BaoBao has to travel to deliver all letters?

It’s NOT necessary that BaoBao ends his delivery in the post office.

Input
There are multiple test cases. The first line of the input contains an integer , indicating the number of test cases. For each test case:

The first line contains two integers and (), indicating the total number of letters and the capacity of the backpack.

The second line contains integers (), indicating the destination of each letter.

It’s guaranteed that the sum of over all test cases will not exceed .

Output
For each test case output one line containing one integer, indicating the minimum distance BaoBao has to travel to deliver all the letters, starting from the post office at .

Sample Input
2
5 3
-1 -2 3 -4 -5
6 3
1 0 -2 -1 1 2
Sample Output
13
6
Hint
For the first sample test case, BaoBao can first deliver the 1st and the 3rd letter (go to , then to , then to the post office), then deliver the 2nd, the 4th and the 5th letter (go to , then to , then to ), and ends his delivery at .

题意&思路

邮递员送信,背包有容量,求最短要跑的距离。
排序,从两头开始,按背包容量分组, 距离都先算两遍,之后减一个最远的。

J.Extended Twin Composite Number

Time Limit: 1 Second Memory Limit: 65536 KB Special Judge
Do you know the twin prime conjecture? Two primes and are called twin primes if . The twin prime conjecture is an unsolved problem in mathematics, which asks for a proof or a disproof for the statement “there are infinitely many twin primes”.

On April 17, 2013, Yitang Zhang announced a proof that for some integer that is less than 70 million, there are infinitely many pairs of primes that differ by . As of April 14, 2014, one year after Zhang’s announcement, the bound has been reduced to 246. People are hoping for the bound to be smaller and smaller, so that a proof for the conjecture can finally be found.

For our dear contestants, we’ve prepared another similar problem for you, which is the extended twin composite number problem: Given a positive integer , find two integers and such that and both and are composite numbers.

Input
There are multiple test cases. The first line of the input contains an integer (about ), indicating the number of test cases. For each test case:

The only line contains one integer ().

Output
For each test case output two integers in one line, indicating and where . If there are multiple valid answers, you can print any of them; If there is no valid answer, output ``-1’’ (without quotes) instead.

Sample Input
3
11
1805296
5567765
Sample Output
4 15
114514 1919810
111234 5678999

题意&思路

找两个合数x,y,使x+n=y,(n题目给)。

n为1时特判,输出8,9即可,其余情况直接输出2n和3n。

后记

四小时AC了五题,第六题有点细节问题。
还是挺满意的啦。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值