1379 - CS I2P (II) 2017-2 Lee Final 2 Scoreboard

Time

2018/01/12 13:30:00 2018/01/12 15:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11055 Vector Intersection
11447 Use std::map
11462 cppreference
11486 Josephus Prob. using Circular Linked List (better)

11055 - Vector Intersection   

Description

Given two vectors of numbers, output their intersection set.

Note: the numbers of vectors need not to be unique.

Input

There are multiple test cases. Each case contains four lines. The first line begins with an integer N. The second line contains N integers, representing the numbers in the first set. The third line has one integer M, and the fourth line contains M integers, represent the numbers in the second set. All the numbers are 32 bit signed integers. The input is terminated if N = 0.

For case 1, 1 <= N, M <= 103
For case 2, 1 <= N, M <= 104
For case 3, 1 <= N, M <= 105
For case 4, 1 <= N, M <= 106

Output

For each test case, print the intersection of the two sets. Output them in ascending order. If the intersection of the two sets is an empty set, print “empty” (without quotes).

 

Note: There's a newline character at the end of each output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11447 - Use std::map   

Description

This problem will help you understand how to use std::map.

http://en.cppreference.com/w/cpp/container/map

Notice, this time, first and last is [first, last].

目前有五個測資,第三筆測資不算,答題測資看另外四筆

Input

The input consist of series of command. Each commands is insert, range output or range erase.

insert: inserts a string (cmd) with the key (key) to map. If the key has already existed, insert the cmd at the begining of string (the string which the key belongs).

For example,

insert 0 "abc"

insert 1 "def"

the map should contain "abc", "def".

insert 0 "xyz"

the map should contain "xyzabc", "def".

 

range output: outputs the string from key (first) to key (last). Output a space character (' ') after printing an element.

 

range erase: erase the string from key (first) to key (last).

 

operator<<: outputs all strings in map. From the smallest key to biggest key. Output a space character (' ') after printing an element.

Output

Complete insert, output, erase and operator<<.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11447.cpp

Partial Judge Header

11447.h

Tags




Discuss




11462 - cppreference   

Description

版本:

20180311

 

使用說明:

請下載code或header(兩個是同個檔案)

把附檔名從.cpp改成.zip

解壓縮後

reference>en>cpp.html

即可看到官方文件

Input

Output

Sample Input  Download

Sample Output  Download

Partial Judge Code

11462.cpp

Partial Judge Header

11462.h

Tags

CPP Reference



Discuss




11486 - Josephus Prob. using Circular Linked List (better)   

Description

In computer science and mathematics, the Josephus problem (or Josephus permutation) is a theoretical problem related to a certain counting-out game.

People are standing in a circle waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a specified direction. After a specified number of people are skipped, the next person is executed. The procedure is repeated with the remaining people, starting with the next person, going in the same direction and skipping the same number of people, until only one person remains, and is freed.

The problem — given the number of people, starting point, direction, and number to be skipped — is to choose the position in the initial circle to avoid execution.

You're asked to solve this problem using circular linked list.

Input

The input has two positive integers, n (the number of people) and m (kill every mth people).

Output

The output is the order of people that were killed.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11486.c

Partial Judge Header

11486.h

Tags




Discuss