TopCoder

User's AC Ratio

80.0% (4/5)

Submission's AC Ratio

54.5% (6/11)

Tags

Description

題目 PDF 檔在這裡

(註:範例輸出請以題本為準)

Input Format

Output Format

Sample Input 1

F=A'B+(CD)'

Sample Output 1

12 41
___
| \ ___
A'--| \ \ \
| |--------\ \
B --| / | |-- F
|___/ +---/ /
___ __ | /___/
| \ | \ |
C --| \ | \ |
| |-----| )o----+
D --| / | /
|___/ |__/

Sample Input 2

F=A(B+(C+D))'E+A'C+G

Sample Output 2

14 73
___
___ __ | \
___ \ \ | \ A --| \ ___
\ \ B ---\ \ | \ | | \ \
C ---\ \ | |-----| )o---------| |----------\ \
| |--------/ / | / | | | |
D ---/ / /___/ |__/ E --| / +-----| |-- F
/___/ |___/ | | |
___ |G ---/ /
| \ | /___/
A'--| \ |
| |----+
C --| /
|___/

Sample Input 3

F=((A+B)'(CD)+E)G((HI+J)+K')LM(OP)

Sample Output 3

26 77
___ __
\ \ | \ ___
A ---\ \ | \ | \ ___
| |-----| )o-------| \ \ \ ___
B ---/ / | / | |--------\ \ | \
/___/ |__/ +--| / | |---------------| \
___ | |___/ E ---/ / | |
| \ | /___/ G --| |
C --| \ | | |
| |----+ +--------| |
D --| / | | |-- F
|___/ | L --| |
___ | | |
| \ ___ | M --| |
H --| \ \ \ ___ | | |
| |--------\ \ \ \ | +--| /
I --| / | |--------\ \ | | |___/
|___/ J ---/ / | |------+ |
/___/ K'---/ / |
/___/ |
___ |
| \ |
O --| \ |
| |------------+
P --| /
|___/

Sample Input 4

F=B+(B)+(B')'+((B)')'

Sample Output 4

15 45
___
\ \
B ---\ \
__ | |
| \ B ---| |
| \ | |-- F
B'--| )o------------| |
| / | |
|__/ +---/ /
__ __ | /___/
| \ | \ |
| \ | \ |
B --| )o-----| )o--------+
| / | /
|__/ |__/

Sample Input 5

F=X

Sample Output 5

1 8
X ---- F

Hints

Problem Source

YTP 2024 國中組程式挑戰營 p13

Subtasks

No. Testdata Range Constraints Score
1 0~4 範例測資 0
2 5~12 $|S| \le 5$ 7
3 13~42 $S$ 中不會有任何單引號(' 9
4 0~72 無額外限制 9

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 262144 65536 1 4
1 1000 262144 65536 1 4
2 1000 262144 65536 1 4
3 1000 262144 65536 1 4
4 1000 262144 65536 1 4
5 1000 262144 65536 2 4
6 1000 262144 65536 2 4
7 1000 262144 65536 2 4
8 1000 262144 65536 2 4
9 1000 262144 65536 2 4
10 1000 262144 65536 2 4
11 1000 262144 65536 2 4
12 1000 262144 65536 2 4
13 1000 262144 65536 3 4
14 1000 262144 65536 3 4
15 1000 262144 65536 3 4
16 1000 262144 65536 3 4
17 1000 262144 65536 3 4
18 1000 262144 65536 3 4
19 1000 262144 65536 3 4
20 1000 262144 65536 3 4
21 1000 262144 65536 3 4
22 1000 262144 65536 3 4
23 1000 262144 65536 3 4
24 1000 262144 65536 3 4
25 1000 262144 65536 3 4
26 1000 262144 65536 3 4
27 1000 262144 65536 3 4
28 1000 262144 65536 3 4
29 1000 262144 65536 3 4
30 1000 262144 65536 3 4
31 1000 262144 65536 3 4
32 1000 262144 65536 3 4
33 1000 262144 65536 3 4
34 1000 262144 65536 3 4
35 1000 262144 65536 3 4
36 1000 262144 65536 3 4
37 1000 262144 65536 3 4
38 1000 262144 65536 3 4
39 1000 262144 65536 3 4
40 1000 262144 65536 3 4
41 1000 262144 65536 3 4
42 1000 262144 65536 3 4
43 1000 262144 65536 4
44 1000 262144 65536 4
45 1000 262144 65536 4
46 1000 262144 65536 4
47 1000 262144 65536 4
48 1000 262144 65536 4
49 1000 262144 65536 4
50 1000 262144 65536 4
51 1000 262144 65536 4
52 1000 262144 65536 4
53 1000 262144 65536 4
54 1000 262144 65536 4
55 1000 262144 65536 4
56 1000 262144 65536 4
57 1000 262144 65536 4
58 1000 262144 65536 4
59 1000 262144 65536 4
60 1000 262144 65536 4
61 1000 262144 65536 4
62 1000 262144 65536 4
63 1000 262144 65536 4
64 1000 262144 65536 4
65 1000 262144 65536 4
66 1000 262144 65536 4
67 1000 262144 65536 4
68 1000 262144 65536 4
69 1000 262144 65536 4
70 1000 262144 65536 4
71 1000 262144 65536 4
72 1000 262144 65536 4