ACM初赛试题(1)

第33届ACM/ICPC亚洲区预选赛_网络选拔赛(杭州)

Start Time : 2008-10-18 12:00:00    End Time : 2008-10-18 17:00:00
Contest Type : Private   Contest Status :
Ended

Current Server Time : 2008-10-19 10:25:43

 

Solved

Pro.ID

Title

Submit

Ratio(Accepted / Submitted)

 

1001

Another Easy Problem

Submit

8.84%(138/1561)

 

1002

Boring Game

Submit

2.32%(6/259)

 

1003

Cube and Caterpillar

Submit

0.00%(0/144)

 

1004

Deciphering Password

Submit

9.25%(208/2248)

 

1005

Essay Scoring System

Submit

0.00%(0/112)

 

1006

Find A Way

Submit

0.00%(0/70)

 

1007

Gary's Calculator

Submit

21.68%(305/1407)

 

1008

Hiking Trip

Submit

35.59%(316/888)

 

1009

Interesting Housing Problem

Submit

14.70%(162/1102)

 

1010

Judges's Final Problem

Submit

0.00%(0/39)

 

 

 

Another Easy Problem

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1561    Accepted Submission(s): 138

Problem Description

Nowadays, many universities no longer force students to follow a fixed curriculum; instead they allow students to choose the courses on an individual basis. However, new programs need to be written to satisfy such needs. Your job is to write such a program.
In our system, the following objects exist: Time Period, Course and Student. The relationships between the three objects are as follows:
A course has a capacity, and is associated with multiple time periods; a student can register for multiple courses in the system (resulting in a possibly conflicting schedule).
To resolve possible conflicts with the schedules as well as to ensure that the number of students registered for each course does not exceed its capacity, the system will use the logic described below to determine the result:
Process courses, in the order they appear in the input.
For each course: Check each student's request in the order it is received, and reject the request if a) accepting the request will result in a conflict in the student's schedule, or b) if no more students could be accepted by this class, or c) the student has already enrolled in this class; otherwise, the request is accepted.

Can you solve this easy problem?

 

 

Input

There are multiple test cases in the input file.
Each test case starts with three integers, N, M and R (1 <= N <= 20, 1 <= M <= 20, 0 <= R <= N * M), the number of students, the number of courses, and the number of requests, respectively.
Each of the following N lines contains one string, the ID of the student. The ID will contain no characters other than '0'...'9' The next part of each test case consists of M lines, each of which contains three integers, I, C, T, (C <= 100, T <= 30), the ID of the course, the capacity, and the number of time periods used by the course respectively; T more integers follows, representing the unique identifiers of the time periods. The description for the requests comes next, each line in the format of [Student ID](Space character)[Course ID], in the order as the requests are received. It is guaranteed that the requests are always valid, i.e., both the student ID and the course ID could be found in the description given above.
Two consecutive test cases are separated by a blank line. Input ends with End-of-File.

 

 

Output

For each test case, print the total number of requests accepted by the system, in the format as indicated in the sample output.

 

 

Sample Input

2 2 4

0

1

101 1 2 3 4

102 2 1 5

0 101

1 102

1 101

0 102

 

1 1 0

4

5 1 1 5

 

 

Sample Output

Case 1: 3

Case 2: 0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值