2851 - I2P(I)2023_Yang_mid1_practice1 (hw4) Scoreboard

Time

2023/10/03 20:30:00 2023/10/24 18:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11635 Position
13637 Easy Gomoku Validator
14009 Convolutional Neural Network
14020 Longest Palindrome Substring

11635 - Position   

Description

Determine the positions of each letter in a given string (with length < 1000001). Then output the positions of each letters in lexicographical order. For each letter, output its positions in increasing order. 

 

For example, “AbAABBCAaa”

 

A is at position 0, 2, 3, 7; B is at position 4, 5; C is at position 6; a is at position 8, 9; b is at position 1.

Input

There is only one row, and it is a string S with length smaller than 1000001. 

Output

Please output the answer according to the above requirements, and remember to add ‘\n’ at the end of the outcome of every letter.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13637 - Easy Gomoku Validator   

Description

Katex

Gomoku, also known as 五子棋, is a kind of board game with the following rules.

Players alternate turns to place a stone of their color on an empty intersection. Black plays first. The winner is the first player to form an unbroken chain of five stones horizontally, vertically, or diagonally. And the game will stop immediately if someone wins the game.

Today LSC and TSC, are playing Gomoku on a \(15x15\) board. Where LSC plays the black side, TSC plays the white side.

It is known that in LSC's \(i\)th turn, he'll place his black stones to the position \((x_{2i-1}, y_{2i-1})\). And in TSC's \(i\)th turn, he'll place his white stones to the position \((x_{2i}, y_{2i})\).

Now given the length of the array \(x\) and \(y\), please determine who wins the game and at what turn he satisfied the winning condition. Or suppose that no one wins, please print "There's no winner." in one line.

Note that all index used in this problem are 1-based.

Solution(click here to view the solution if you don't want to solve it yourself)

Input

Katex

The first line of the input contains \(1\) integer \(N\), the length of array \(x\) and \(y\).

The following \(N\) lines, each contains two intergers \(x_i, \space y_i\).

    Constraints

  • \(1 \le N \le 15*15\)
  • \(1 \le x_i, y_i \le 15\)
  • \((x_i, y_i) \neq (x_j, y_j) \forall i \neq j\)

Output

Katex

Print your answer in one line.

Suppose LSC wins at the \(i\)th step, you should print("LSC wins at the %dth step", i), it is similar if TSC wins.

Print "There's no winner." if there's no winner.

Sample Input  Download

Sample Output  Download

Tags

LoseLightLight



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




14020 - Longest Palindrome Substring   

Description

Given multiple strings composed of only {'A','T','C','G'}.

That is, for any char c in the strings, c == 'A' or c == 'T' or c== 'C' or c== 'G'.

Find the length of the longest palindrome substring in each given string and output its length.

 

Palindrome: a string that is identical to its reverse, like "level" or "aba".

 

Substring: a contiguous sequence of characters within a string. For example, "ABC" , "CDEF" and "G" are substrings of "ABCDEFG", but "ACDE" isn't, because it is not contiguous in the main string. Note that a string is a substring of itself.

 

Input

The input consists of multiple test cases.

Each of the test cases contains a string.

 

It is guaranteed that the length of each given string will not exceed 10000.

 

Output

For each given string, print the length of the longest palindrome substring of that string, ended with a new line character '\n'.

 

 

Sample Input  Download

Sample Output  Download

Tags




Discuss