3065 - I2P(I)2024_Yang_hw3 Scoreboard

Time

2024/09/23 17:20:00 2024/10/01 18:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13586 Patrick's Calculator
14009 Convolutional Neural Network
14436 Exchange Department

13586 - Patrick's Calculator   

Description

Patrick Star is trying to implement a basic calculator that supports addition, subtraction, multiplication, and division in the C program. Unfortunately, Patrick can't find the bug with his program for the addition operation, and he needs your help!

The problem is quite simple, calculate the sum of the given two numbers.

To represent the decimal number more clearly, we add commas (,) to the number to group the digits. e.g. 1,234,567. The commas will be added to the input two numbers. You will also need to output the answer with commas.

Please notice that the two numbers might be too large to fit in the int data type, and you may consider storing these two numbers in the other way.

Input

The input contains two lines, each line with a single number.

The digit of these two numbers (not including commas) is no more than 100.

Output

The output contains one line with one single number, the sum of the two numbers.

Sample Input  Download

Sample Output  Download

Tags




Discuss




14009 - Convolutional Neural Network   

Description

A Convolutional Neural Network (CNN) is a type of artificial neural networks that is primarily used for processing and analyzing visual data, such as images and video frames. CNNs have become widely popular in computer vision tasks due to their ability to automatically learn and extract meaningful features from input images. They consist of multiple layers, including convolutional layers, pooling layers, and fully connected layers, which work together to detect and recognize patterns in the data.

Today, Stiff Waist Beast wants to implement a small CNN, which processes an input image that is represented as a matrix of pixels with the following steps:

1. Horizontally flip the input image to enable the CNN to handle images with varying orientation.

2. Apply convolution using a filter to the flipped image.

 

The convolution is defined as follows:

Given an n * n image A and an m * m filter B, the resulting feature map after convolution is another (n - m + 1) * (n - m + 1) matrix C, where each element of C is computed as 

 

Finally, Stiff Waist Beast is curious about the number of pixels in the resulting feature map whose values exceed a given threshold k (for fun only ^^).

 

As a poor student, there are still many tasks waiting for Stiff Waist Beast to handle in the association. He asks you to finish this task.

Input

The first line contains an integer T, representing that there will be T testcases.

The first line of each testcase has three integers n, m, k.

Each of the following n lines has n integers, aij, representing image A.

And each of the following m lines has m integers, bij, representing filter B.

1 <= T <= 10, 1 <= n <= 500, 1 <= m <= min(n, 5), 0 <= aij, k < 256, -5 <= bij <= 5.

Output

Print an integer: the number of elements in the resulting feature map C whose values exceed the given threshold k.

Don't forget to print '\n' in the end!

Sample Input  Download

Sample Output  Download

Tags




Discuss




14436 - Exchange Department   

Description

In a company, there are N employees and M departments, with employees' IDs numbered from 1 to N. Initially, employee i is assigned to department Ai.

Recently, the company has introduced several new product development plans, which have resulted in a series of personnel transfers. Specifically, for each transfer, a pair xi and yi is provided, indicating that the employee with ID xi and the employee with ID yi will swap departments.

These transfers happen in a specific order, where if i < j, the employees xi and yi swap departments first, followed by employees xj  and yj.

The company’s boss would like to know which employees are in department Q after T transfers. Can you design a system that can provide this information?

Input

The first line of input contains three positive integers N, M, and T, representing the number of employees, departments, and personnel transfers, respectively.

The second line contains N integers A1, A2, ..., A, where Ai represents the initial department of the i-th employee.

The next T lines (from the 3-rd line to the (T + 2)-th line) each contain two integers, xi and yi, indicating that employee xi and employee yi swapped departments during the corresponding personnel transfer.

The (T + 3)-th line contains a positive integer Q, representing the department the company's boss is inquiring about. Specifically, it asks which employees are currently assigned to department Q.

 

Constraints

  • 1 ≤ N,T ≤ 105
  • 1 ≤ M ≤ min(N,100)
  • 1 ≤ Q ≤ M
  • for all i in [1,N], 1 ≤ Ai ≤ M
  • for all i in [1,N], 1 ≤ xi,yi N ; xi yi

Subtasks

  • Testcases 1~3: 1 ≤ N,T ≤ 500
  • Testcases 4~5: N = 100; Ai = i
  • Testcases 6~7: T = 1
  • Testcases 8~10: No additional restrictions.

Output

Please output one line containing all employee IDs that are currently assigned to department Q after T personnel transfers, in increasing order.

Employee IDs should be separated by a space, and please ensure that there is no space after the last employee ID. 

Please print "\n" at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss