2721 - I2P(I)2022_Hu_Final Scoreboard

Time

2023/01/09 18:30:00 2023/01/09 21:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13811 I hate winter vacation
13812 Advanced Convolution
13813 Two Fake Knights

13811 - I hate winter vacation   

Description

Jacky hates winter vacation because he learned the knowledge of coding and he met a lot of friends.

Fortunately, he comes up with an idea that he can keep practicing programming by modifying the final practice!

Good job!

nc

The problem is modified from problem 13412.

Given the head of the linked list containing multiple groups (the size of each group is k ), sort the nodes inside each group at a time.

k is a positive integer and is less than or equal to the length of the linked list.

If the number of nodes is not a multiple of k, then the left-out nodes in the end should remain the same order.

You are not allowed to alter the values in each node.

All the numbers in the linked-list is a unique number.

For example, when k = 2:

Note that it is a partial-judge problem that you need to implement the function:

Node* Solver(Node* head, int k)

 

Input

The first line is composed of a sequence of integer(1<= val <=100000000), which represents the values of the linked list.

The input stops when read in '-1' ('-1' is not a part of the 2 linked-lists).

The second line is k,  the size of the group that will be reversed.(1 <= k <= length of the linked list)

Output

The values of the group-based reversed linked-list.

The values are separated by a whitespace and the output is also ended with a whitespace.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13811.c

Partial Judge Header

13811.h

Tags




Discuss




13812 - Advanced Convolution   

Description

In this problem, you have to implement a 2D convolution operation with zero-padding and stride.

Convolution is an operation that you elementwise multiply the sub-region in the original image(A larger 2D array) and the provided kernel(A smaller 2D array) and the summation of the multiplied values will be the new values in the output map(The size may be different from the original image). The multiplication follows a sliding window, so once we reach the bottom-right, we'll get a brand new 2D map.

 

Once you understand how to do simple convolution, another trick in convolution is that you can pad the original map with zeros, which is called zero-padding.

 

Last, we can decide the step size of the sliding window, which is called stride.

 

To sum up, you'll be given a 2D image and a 2D kernel, you are asked to do the convolution with the given padding size and stride.

Testcase 1~3: No padding, stride = 1 (Simple convolution)
Testcase 4: No padding, stride > 1 (Only considering stride)
Testcase 5: With padding, stride =1 (Only considering padding)
Testcase 6: With padding, stride > 1

 

Note that you only have to do the convolution in the valid region.

 

 

Input

The first line contains 2 integers, the height and the width of the 2D image, respectively. (1 <= height, width <= 1024)

Next, you have to read the whole 2D image.

The following line contains 2 integers, the height and the width of the 2D kernel, respectively. (1 <= height, width <= 10)

Then, you have to read the whole 2D kernel.

The last line will be the the size of stride and padding, respectively. (0 <= size of stride and padding <= 10)

 

All the values mentioned above are integers.

It is guaranteed every value of 2D images <= 255 and and 2D kernel is <= 10

Output

Please print the calculated 2D map.

The elements are separated by whitespace and you have to print '\n' at the end of each row.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13813 - Two Fake Knights   

Description

There are N FAKE knights in the city. In order to protect the city, you need to find two FAKE knights to protect the whole area.

 

There are K defending properties, two FAKE knights can protect the city perfectly if, for each property, both of them have it or none of them have it.

 

For example:

we'll use A1 = [1, 3] describing that the first knight has properties 1 and 3.

 

If K = 3, A1 = [1, 3], and A2 = [1, 3], they can protect the city perfectly.

However, if K = 5, A1 = [1, 2, 5] and A2 = [1, 4, 5], they cannot protect the city since properties 2 and 4 do not satisfy the constraint.

 

Given the properties of N knights, how many ways you can select two knights such that the city can be protected perfectly?

 

Testcase 1 ~ 6:

1 ≤ N ≤ 103, 1 ≤ K ≤ 10

Testcase 7 ~ 8:

N = 30000, K = 15

 

Hint 1: Think carefully before you start!

Hint 2: You can refer to these bitwise operators if you need.

Input

There're two integers N and K, describing the number of knights and the number of properties.

 

For the next N lines, each line contains K digits (0 or 1). the k-th digit on the i-th line describes whether knight i has the property k.

 

Output

Output the number of ways you can choose to protect the city. Print a newline character at the end of the line.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss