PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#FW0000033. Tự lắp ghép phân tử (Self-Assembly)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tự lắp ghép phân tử (Self-Assembly)
Self-Assembly
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
Each square molecule has four connectors labeled with uppercase letter and sign or 00. Matching opposite signs can bond; molecules can rotate or flip. Determine whether arbitrarily large assemblies are possible.
Input
Integer , followed by strings of length 8, each encoding four two-character connector labels.
Output
Print unbounded for unlimited assembly, otherwise bounded.
Subtasks
- Subtask 1 (40 points): ; ; each connector is
00or an uppercase letter followed by+or-; molecule types may repeat. - Subtask 2 (60 points): ; each connector is
00or an uppercase letter followed by+or-; molecule types may repeat.
Examples
Input
1
K+K-Q+Q-
Output
unbounded
Explanation
The molecule has complementary K+/K- and Q+/Q- connectors. These induce a cycle in the connector-state graph, allowing unbounded repetition.