2951 - 2024_IDS_Spring_Lab1 Scoreboard

Time

2024/02/26 00:00:00 2024/03/11 23:59:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14222 2024_IDS_Spring_Lab1_Binary Search Problem
14223 2024_IDS_Spring_Lab1_Merge Sort Problem

14222 - 2024_IDS_Spring_Lab1_Binary Search Problem   

Description

There is a non-increasing integer array A with nn integers. (The integers may duplicate.)

You are given an array Q with mm integers, each integer denotes a query.

For each query, find if the integer exists in A . If yes, output “Y”. Otherwise, output “N”.

Input

The first line contains two integers n and m — the number of integers in array A and the number of integers in array Q.

The second line contains n integers a1,a2,⋯ ,an — the elements of the array A.

The third line contains m integers q1,q2,⋯ ,qm — the elements of the array Q.

Restrictions

Output

For each query, output “Y” or “N” — the integer of the query is in the array A or not.

Please append a space after each query.

Sample Input  Download

Sample Output  Download

Tags




Discuss




14223 - 2024_IDS_Spring_Lab1_Merge Sort Problem   

Description

Given an integer array a1,a2,⋯ ,an with n integers, sort the array in non-ascending order using merge sort. Output the sorted array.

Input

The first line is an integer n, being the size of the integer array.The second line contains nn integers a1,a2,⋯ ,an​, being the elements of the integer array.

Constraints

Output

Output the sorted array in one line.

Please append a space after each number, and add a newline at the end of the output.

void merge();
//merge two sorted array
 
void merge_sort();
//divide and conquer
 
int main() {
    /*
    int n;
    cin >> n;
    ...
    Read the input file
    */
 
    /*
    Using merge_sort method to sort your array
    */
 
    /*
    Output the sorted array
    for(int i = 0; i < arr.size(); i++) {
        cout << arr[i] << ' ';
    }
    cout << endl;
    */
}

 

Sample Input  Download

Sample Output  Download

Tags




Discuss