1573 - I2P (I) 2018_Chen_Final Scoreboard

Time

2019/01/10 12:10:00 2019/01/10 15:40:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12117 CS_2018_FINAL-1
12118 CS_2018_FINAL-2
12119 CS_2018_FINAL-3
12120 CS_2018_FINAL-4
12121 CS_2018_FINAL-5

12117 - CS_2018_FINAL-1   

Description

Given two strings s and t, your task is to figure out whether there exists s’ equals to t, where we denote s’ as a left rotation or a right rotation of s.

For example, if s = “abcd”, then s’ can either equals to “abcd”, “bcda””cdab” or dabc.

 

Input

The input consists of multiple test cases. The first line of the input contains one integer T, which is the number of the test cases (1 ≤ T ≤ 100). Each of the following n lines contains a test case formatted as follows.

s t

and t are the two string mentioned above. The length of s and t are the same, and both of them are between 1 and 100, inclusive.

Output

For each test case, print "Yes" if there exists s' equals to t, otherwise print "No".

There is a newline character ‘\n’ at the end of line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12118 - CS_2018_FINAL-2   

Description

Given a linked list, you have to reverse it and output the result.

You have to implement four function:

1. Node* Create_List(Node*, int);

This function is used to create the linked list according to the input.

2. Node* Reverse_List(Node*);

This function is used to reverse the given linked list.

3. void Print_List(Node*);

This function is used to print out the key value in the linked list.

4. void Free_List(Node*);

This function is used to free the memory space.

Input

The first line contains one integer n, representing the number of nodes in the linked list.

The next lines contains n integers, each integer represents a node in the linked list.

It is guaranteed that :

  • 1 ≤ n ≤ 10
  • 0 ≤ ai ≤ 100

Output

You need to output the reversed linked lists.

Each key value is separated by "->".

You need to print '\n' in the end

Sample Input  Download

Sample Output  Download

Partial Judge Code

12118.c

Partial Judge Header

12118.h

Tags




Discuss




12119 - CS_2018_FINAL-3   

Description

Writer: jjjjj19980806       Description: pclightyear        Difficulty: ★★★

Given n numbers, you need to find a number k such that SUM is minimum,

where we define SUM = ( a1 ^ k ) + ( a2 ^ k ) + ... + ( an ^ k )

(^ stands for the "xor" bitwise operation of the two operand)

Input

The first line contains an integer n, representing the number of numbers.

The next line contains n integers ai, representing each given number.

It is guaranteed that:

  • ≤ 105
  • 0 ≤ ai ≤ 106
  • All numbers ( ai and k ) are unsigned numbers

Output

Please output the value of SUM.

Note SUM may exceed INT.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12120 - CS_2018_FINAL-4   

Description

There are N points in a D-dimensional Euclidean space.

Given a test point x, find its kth nearest neighbor among the N points.

Input

The first line contains three integers NDk representing the number of points, the dimension, and the parameter k for k-nearest neighbor. The next N lines contain the coordinates of the N points. The last line contains the coordinate of the test point x.

For example, consider the following five points in 2-dimensional space.

(0.0, 0.0), (5.0, 0.0), (5.0, 5.0), (0.0, 5.0), (2.5, 2.5)

The test point is (-1.0, 0.5). Suppose that we want to find its 3rd nearest neighbor (k=3). The answer is the point (0.0, 5.0). Use printf “%.1f” format to show the decimal values.

 

It is guaranteed that

  • 0 < N, D ≤ 1000
  • k ≤ 30
  • All coordinate values can be represented by float

Output

The kth nearest neighbor of x among the N points.

(We guarantee that the kth nearest neighbor of x is unique.)

Use printf “%.1f” format to show the decimal value.

There is a newline character ‘\n’ at the end of line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12121 - CS_2018_FINAL-5   

Description

There are n factories. Each factory can be assigned to produce one of the two kinds of cars (car A& car B). The net profit of producing car or car for each factory will be given. The goal is to assign x factories to produce car Aand y factories to produce car so that the net profit is maximized. It is possible that some factories do not produce any cars (i.e. x + y  <= n).

Suppose that you can choose two factories and switch the profits of car for those two factories. You need to take into consideration of all possible switches and assignments of production, and find the best way to maximize the total profit. Based on the solution, your program needs to print the names of the x factories that produce car in lexicographical order. If there are multiple answers, you need to print the one such that the total net profit of car Ai s maximum. 

Note that if two factory produce same profits, choose the one with smaller lexicographical order. The swtich of car A of any two factory can be executed once only.

Note that when switch executed, the name of factory or the profit of car B will not be changed.

Input

The first line contains four integers nxy, representing the total number of factories, the number of factories planned to produce car A, and the number of factories planned to produce car B.

Each of the next lines contains one string si and two integers aibii, representing the name of each factory and the net profit each factory can make if it is assigned to produce car or car B.

It is guaranteed that

  • 0 < n, x, y ≤ 300
  • x + y <= n
  • 1 ≤ | s | ≤  20
  • 0 < ai, bi < 106
  • a≠ aj, b≠ bj   if i ≠ j.
  • No duplicate names.

Output

Find the assignment of the car type for each factory so that the profit is maximized.  

Print the list of x factories that need to produce car in lexicographical order.

Sample Input  Download

Sample Output  Download

Tags

rrrrrrrrrrrrrrrrrr



Discuss