没有合适的资源?快使用搜索试试~ 我知道了~
The 36th ACM/ICPC Asia Regional Shanghai Site —— Online Contest
需积分: 9 5 下载量 166 浏览量
2011-09-10
12:56:20
上传
评论
收藏 422KB PDF 举报
温馨提示
The 36th ACM/ICPC Asia Regional Shanghai Site —— Online Contest Problem Set
资源推荐
资源详情
资源评论
1 / 17
第 36 届 ACM 国际大学生程序设计竞赛
亚洲区上海预选赛
The 36th ACM/ICPC Asia Regional Shanghai Site
Online Contest
2 / 17
A. 24 Puzzle
Daniel likes to play a special board game, called 24 puzzle. 24 puzzle is such a game that
there are tiles with the number 1 to 23 in a play board like the follow picture:
# #
######
####
####
######
# #
The ‘#’ denotes the positions that the tiles may be placed on. There are 24 possible positions
in total, so one of them is not occupied by the tile. We can denote the empty position by zero.
Daniel could move the tiles to the empty position if the tile is on the top, bottom, left or
right of the empty position. In this way Daniel can reorder the tiles on the board.
Usually he plays with this game by setting up a target states initially, and then trying to do a
series of moves to achieve the target. Soon he finds that not all target states could be achieved.
He asks for your help, to determine whether he has set up an impossible target or not.
Input
The first line of input contains an integer denoting the number of test cases.
For each test case, the first line contains 24 integers denoting the initial states of the game
board. The numbers are the describing the tiles from top to bottom, left to right. And the empty
position is indicated by zero. You can assume that the number of each tile are different, and there
must be exactly one empty position. The second line of test case also contains 24 integers
denoting the target states.
Output
For each test case, if the target is impossible to achieve, output ‘Y’ in a single line, otherwise,
output ‘N’.
Sample Input
2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
3 1 2 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
3 0 2 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Sample Output
N
Y
3 / 17
B. Bombing
It’s a cruel war which killed millions of people and ruined series of cities. In order to stop it,
let’s bomb the opponent’s base.
It seems not to be a hard work in circumstances of street battles, however, you’ll be
encountered a much more difficult instance: recounting exploits of the military. In the bombing
action, the commander will dispatch a group of bombers with weapons having the huge
destructive power to destroy all the targets in a line. Thanks to the outstanding work of our spy,
the positions of all opponents’ bases had been detected and marked on the map, consequently,
the bombing plan will be sent to you.
Specifically, the map is expressed as a 2D-plane with some positions of enemy’s bases
marked on. The bombers are dispatched orderly and each of them will bomb a vertical or
horizontal line on the map. Then your commanded wants you to report that how many bases will
be destroyed by each bomber. Notice that a ruined base will not be taken into account when
calculating the exploits of later bombers.
Input
Multiple test cases and each test cases starts with two non-negative integer N (N<=100,000)
and M (M<=100,000) denoting the number of target bases and the number of scheduled
bombers respectively. In the following N line, there is a pair of integers x and y separated by
single space indicating the coordinate of position of each opponent’s base. The following M lines
describe the bombers, each of them contains two integers c and d where c is 0 or 1 and d is an
integer with absolute value no more than 10
9
, if c = 0, then this bomber will bomb the line x = d,
otherwise y = d. The input will end when N = M = 0 and the number of test cases is no more than
50.
Output
For each test case, output M lines, the ith line contains a single integer denoting the number
of bases that were destroyed by the corresponding bomber in the input. Output a blank line after
each test case.
Sample Input
3 2
1 2
1 3
2 3
0 1
1 3
0 0
Sample Output
剩余16页未读,继续阅读
资源评论
maooyer
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于SimPy和贝叶斯优化的流程仿真系统.zip
- (源码)基于Java Web的个人信息管理系统.zip
- (源码)基于C++和OTL4的PostgreSQL数据库连接系统.zip
- (源码)基于ESP32和AWS IoT Core的室内温湿度监测系统.zip
- (源码)基于Arduino的I2C协议交通灯模拟系统.zip
- coco.names 文件
- (源码)基于Spring Boot和Vue的房屋租赁管理系统.zip
- (源码)基于Android的饭店点菜系统.zip
- (源码)基于Android平台的权限管理系统.zip
- (源码)基于CC++和wxWidgets框架的LEGO模型火车控制系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功