| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 9465 | Counting Sort |
|
| 9466 | Matrix Multiplication |
|
| 9467 | Parentheses Matching |
|
| 9468 | Prime Factors |
|
| 9469 | Column Sum and Row Sum |
|
Description
Input
The input includes multiple test cases. In each test case, the first line contains one integers N. The next line contains N integers.
Hint:
The sorting algorithms in O(n lg n) don’t work.
To avoid Time Limit Exceeded in Input/Output process, try to use scanf / printf to replace cin / cout.
1 <= N <= 2*106
0 <= Xi <= 104
Case 1: 1 <= N <= 105
Case 2: 1 <= N <= 106
Case 3: 1 <= N <= 106
Case 4: 1 <= N <= 2*106
Output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Input
First line contains a positive integer t (t <= 50), which indicates the numbers of test cases in the input. The first line of each test case contains three positive integers m, n, p (m, n, p <= 100) for the dimension of matrices. In the next m lines, each line contains n integers, representing the elements of matrix A. Followed by n lines, each line containing p integers, represent the elements of matrix B. All elements of A and B are integers in the range [-5, 5].
Case 1: m, n, p <= 20
Case 2: m, n, p <= 40
Case 3: m, n, p <= 60
Case 4: m, n, p <= 100
Output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
A string is said to be valid if it matches one of the following rules:
(1) The string is an empty string.
(2) If a string S is valid, then {S}, [S], (S) and <S> are valid.
(3) If strings S1 and S2 are both valid, then S1S2 is valid.
Given a string consisting of parentheses, determine if it is a valid string.
Input
The first line of the input contains an integer N (N ≤ 1000) denoting the number of test cases followed by. Each of the nextN lines corresponds to a test case, which contains a string consisting of parentheses, and the maximum string length will be no more than 1000. Note that an empty string (a line which contains the newline character only) may be contained in the input and it should be considered as a valid string according to rule (1).
Output
For each test case, print “Case i:” and then “Yes” or “No” to indicate that the string is valid or not, separated by a space character. i is the test case number starting from 1.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given an integer N, list all prime factors of N.
Input
There are several test cases. In each test case, there is an integer N ( 2 <= N < 1000000 ) occupied a newline.
Case 1: N<200, #test cases<=20
Case 2: N<2000, #test cases<=200
Case 3: N<200000, #test cases<=2000
Case 4: N<1000000, #test cases<=200000
Output
List all prime factors of N in acsending order in a line. Seperate the prime factors with a space.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a M*N integer array, please output the smallest column-sum and row-sum.
Input
There are multiple test cases. Each case starts with two integers M and N in a line. Then a M*N integer array follows. Integers are separated by blank. All the numbers in the array are in the range [-107, 107]. Please see the sample input.
Case 1: 1 <= M, N <= 10
Case 2: 1 <= M, N <= 100
Case 3: 1 <= M, N <= 1000
Case 4: 1 <= M, N <= 100000, 1 <= M*N <= 1000000
Output
For each case, output the smallest column-sum and row-sum in a line, separated by a blank.