The ACM/ICPC Asia Harbin Online First Round Contest 2010 Warmup-1

来源:互联网 发布:dbc2000数据库 中文版 编辑:程序博客网 时间:2024/04/30 04:05

1002

Dot In Closed Area

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 444   Accepted: 111  

Description

Tigers are enclosed in wire-net fencing at zoo.If they get out of the fencing, they may attack people.We use some lines to present the fencing as the picture following:

Your task is to judge if a tiger in the fencing or not.

In picture 1 the tiger is in the fencing.

Note that enclosed fencing may look like picture 2 where the tiger is not in the fencing.

Input

The first line of input is a integer t(1<=t<=100),the number of test cases.The first line of each test case contains a integer n(1<=n<=100), the number of vertexes of the fencing.The second line contains the position of the tiger followed by n vertexes of the fencing in counter-closewise order.All numbers are integers in interval[0,10000].

Output

Print "yes" if the tiger is in the fencing or at the border,print "no" if not.

Sample Input

1
5
100 76
55 118
119 114
147 66
123 33
68 56

Sample Output

yes

 

1003

Eular Graph

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 484   Accepted: 291  

Description

Eular graph is a graph that you can start from one vertex X and go through all the edges only once and go back to vertex X, your task is to judge whether a given graph is a Eular graph or not.

A graph will be given like this:
Give n vertexes identified from 1 to n,and a set of edges described as i,j which means that there is a edge from vertex i to vertex j. Edges are directional.

Input

Input contains serveral test cases.First line of the input file is a integer t(1<=t<=100) presents the number of test cases.Each test case contains two parts. Part one contains two integer n and m. n is the number of vertexes and m is the number of edges. Part two contains m lines with two integers(i and j)1<=i,j<=100.

Output

For each test case,print yes if the graph is a Eular graph and no if not.

Sample Input

2
5 5
1 2
2 3
3 4
4 5
5 1
4 3
1 2
2 3
3 4

Sample Output

yes
no

 

 

1004

Exchange Apples

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 406   Accepted: 287  

Description

There are N(2<=n<=100000) students standing in q line, the distance between adjacent students is 1. A student send one apple to the adjacent student takes 1 unit of work. Each student may have extral apples or he may want some apples.

Give you a sequence of integers, integer Xi at the position of i means that the i'th student has Xi extral apples, if Xi is negative, it means that he want -Xi apples.

Your job is to find the minimum overall work of all the students to make that none student have extral apples nor student want apples. You may assume that the sum of all Xi(1<=i<=N) is

0.

Input

Input contains multiple test cases. The first line is a integer, the number of cases. Each case begin with a integer N, then N integer follows.

Output

For each case print the minumum amout of work needed to fulfill the problem.

Sample Input

2
5
6 -4 1 -4 1
6
-6 -7 -8 8 9 4

Sample Output

12
57

 

1005

Kth Largest

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 759   Accepted: 105  

Description

There are two sequences A and B with N (1<=N<=10000) elements each. All of the elements are positive integers. Given C=A*B, where '*' representing Cartesian product, c = a*b, where c belonging to C, a belonging to A and b belonging to B. Your job is to find the K'th largest element in C, where K begins with 1.

Input

Input file contains multiple test cases. The first line is the number of test cases. There are three lines in each test case. The first line of each case contains two integers N and K, then the second line represents elements in A and the following line represents elements in B. All integers are positive and no more than 10000. K may be more than 10000.

Output

For each case output the K'th largest number.

Sample Input

2
2 1
3 4
5 6
2 3
2 1
4 8

Sample Output

24
8

Reverse

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 954   Accepted: 462  

Description

Given an array of integers, your job is to print it in the reverse order.
For example:
Given an array of 1,2,3,4,5 you should output 5,4,3,2,1.

Input

Input contains multiple test cases. The first line is a integer T, the number of test cases. The first line of each test case is a integer N, the number of elements in the array. Then a line with N integers follows

.

Output

For each test case, print the reversed order of the input array

.

Sample Input

1
5
1 2 3 4 5

Sample Output

5 4 3 2 1

 

我们的队伍是team11

最终成绩是42,如果这要是区域赛成绩该多好啊!!!(虽然这次的成绩不错,可还是感觉到实力差距之大,全国的人都在做题,还有,如果没有模版,看样大概是3道题了……,实力有待提高啊,明年的这个时候可不能这样了)

这场比赛是6点开始---到9点,我们队3给人,我6点半到的,桂晨早已把最水的1006A掉(1Y)。接着我把欧拉回路那题A掉(其间罚时一次,源于自己调试时的输出没有改为注释)(2Y)。7点左右冯新宇到了。接着冯新宇把1004那题A掉(1Y),说是算法导论上的。接着我借着宋师哥模板把Kth Largest这题A掉(1Y)。最后桂晨借着计算机和的模板把1002A掉(3Y时我的过失,我也找了个模板,错了两次)。

嘿,这场比赛主要是靠着模板得的成绩,要是没有模板………………汗!!!

去年十一月份开始的ACM之旅,到现在,会的太少了……   玩的太多了,学的太少了……

 

http://acm.hrbeu.edu.cn/index.php?act=contest&cid=14

 

 

 

 

 

老师,您好:
针对部分学校反应,原网址无法登陆的现象,现将比赛网址更改如下(例如:将原来的id=14改成cid=14):
网络预选赛热身赛(一)
测试内容:网络和评判系统环境
比赛地址:http://acm.hrbeu.edu.cn/index.php?act=contest&cid=14
2010年9月8日  18:00—21:00
网络预选赛热身赛(二)
测试内容:网络、系统负载
比赛地址:http://acm.hrbeu.edu.cn/index.php?act=contest&cid=15
2010年9月9日 18:00—21:00
第35届ACM/ICPC亚洲区预赛(哈尔滨)网络预选赛
2010年9月11日 13:00—17:00(四个小时)
比赛地址:http://acm.hrbeu.edu.cn/index.php?act=contest&cid=16
给您带来的不便表示抱歉!
祝:比赛顺利,取得好成绩!
张文涛
哈尔滨工程大学
team7
唐宇
赵智超
陆云飞
team8
丁世强
嵇跃德
何毓锟
team9
胡庆达
孔智慧
秦孝廉
team10
毛有祥
王萌
刘健
team11
赵东广
桂晨
冯新宇
team12
史文
强玉庭
邢雪
team12
季旭
李元骏
杜舒
team12
高闯
陈政委
朱冠宇
杜舒