当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2494:Acid Text

题目描述
Background
A couple of months ago the web standards project (WaSP) has come up with a test for modern browsers and their CSS implementation called acid2. This test ensures that all the browsers have similar results when it comes to parsing and displaying cascaded style sheet files (CSS) for HTML. Since you want to beat all the other text-based browsers on standard compliance you directly start implementing the CSS capabilities into your favorite text-browser Lynks.
Problem
Your text-browser will be given a set of graphic files and a simplified css-style-sheet. A graphic is defined by a name, height, width and a 2-dimensional array of characters. All characters are to be printed except for the character '.' which denotes a transparent pixel. Here is an example picture:

owl.png 5 7
.-----.
|O...O|
|..v..|
|.<_>.|
.-----.

Given the style-sheet your task is it to produce the graphical result that the browser is supposed to display. A CSS-file is made up from a number of entries where each entry looks like this:
#<id> {

pos-x : <x> px ;
pos-y : <y> px ;
position : <relative = <id of graphic>|absolute> ;
file : <filename> ;
layer : <layer-number> ;
}

The following rules hold for the CSS-entries:
Lines Each CSS-entry will be given on exactly 7 lines as in the input above.
Ordering Each CSS-entry will contain exactly the 5 attributes pos-x, pos-y, position, file and layer, in this order, each attribute on a separate line.
Whitespace There may be zero or more white-spaces (spaces and tabs) at the beginning of lines, at the end of lines or everywhere where the sample above has a space.
Here are the rules for composing the picture:
Background The background is assumed to be black (i.e. just spaces).
Positioning The top left corner of the viewing device is assumed to be x : 0, y : 0. Absolute positioning always is based on this top-left corner. Relative positioning information is always based on the topleft pixel of another graphic. There will not be any circular references between CSS elements. All resulting positions will be zero or greater in x and y.
Layering Graphics with a higher layer number are to be printed after graphics with a lower layer number. Graphics with the same layer number are to be printed in the order they appear in the CSS.
输入解释
The first line of the input is the number of scenarios that will follow. For each scenario the following information is given: The first line contains the number of files to follow (at least one, at most 100), each of which is given by a space separated triple of a filename f, a height h, a width w (1 <= w, h <= 100) and then h lines, each with exactly w characters. Following the file definition is a single line with a number m (at least one, at most 500), which is followed by a CSS file of m entries.
You can assume the resulting picture to be at most 1000 x 1000 characters large. All coordinates in CSS entries will be given as integers with an absolute value less than 1000000. All filenames and identifiers are made up from alphanumeric characters and dots only. No two files have the same name and no two identifiers are equal. The layer attribute will be at least 0 and at most 1000000.
输出解释
The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. For each scenario print the resulting picture from overlaying all the given graphics following the instructions in the CSS file. Your result for each scenario should be rectangular as small as possible. However, transparent pixels always belong to the resulting picture, even if they are located directly at the border. The top-left corner of the result should always contain position (0, 0). All empty areas should be padded with spaces. Terminate the output for every scenario with a blank line.
输入样例
1
4
bg.png 5 7
.-----.
|.....|
|.....|
|.....|
.-----.
eye.jpg 1 1
O
nose.bmp 1 1
v
mouth.png 1 3
<_>
5
#bg {
	pos-x: 1 px;
	pos-y: 1 px;
	position: absolute;
  file: bg.png;
  layer: 0;
} 
#leftEye {
	pos-x: 1 px;
	pos-y: 1 px;
	position: relative=bg;
  file: eye.jpg;
  layer: 1;
} 
#rightEye {
	pos-x: 4 px;
	pos-y: 0 px;
	position: relative=leftEye;
  file: eye.jpg;
  layer: 1;
}
#nose {
  pos-x: 2 px;
  pos-y: 1 px;
  position: relative=leftEye;
  file: nose.bmp;
  layer: 1;
}              
#mouth {
  pos-x: -1 px;
  pos-y: 1 px;
  position: relative = nose;
  file: mouth.png;
  layer: 1;
}
输出样例
Scenario #1:
        
  ----- 
 |O   O|
 |  v  |
 | <_> |
  ----- 


该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2494

最后修改于 2020-10-29T06:33:59+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536