Submission #63012259


Source Code Expand

Copy
S = input()
stack = []
for c in S:
if c in "([<":
stack.append(c)
else:
if not stack:
print("No")
exit()
t = stack.pop()
if (c == ")" and t != "(") or (c == "]" and t != "[") or (c == ">" and t != "<"):
print("No")
exit()
print("Yes" if not stack else "No")
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
S = input()
stack = []
for c in S:
    if c in "([<":
        stack.append(c)
    else:
        if not stack:
            print("No")
            exit()
        t = stack.pop()
        if (c == ")" and t != "(") or (c == "]" and t != "[") or (c == ">" and t != "<"):
            print("No")
            exit()
print("Yes" if not stack else "No")

Submission Info

Submission Time
Task D - Colorful Bracket Sequence
User tamakiiiiii
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 358 Byte
Status AC
Exec Time 74 ms
Memory 88764 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 40
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt
Case Name Status Exec Time Memory
example_00.txt AC 57 ms 76320 KB
example_01.txt AC 59 ms 76544 KB
example_02.txt AC 59 ms 76308 KB
hand_00.txt AC 72 ms 88376 KB
hand_01.txt AC 66 ms 81572 KB
hand_02.txt AC 72 ms 88556 KB
hand_03.txt AC 58 ms 76600 KB
hand_04.txt AC 72 ms 88740 KB
hand_05.txt AC 57 ms 76432 KB
hand_06.txt AC 58 ms 76192 KB
random_00.txt AC 63 ms 84544 KB
random_01.txt AC 73 ms 88764 KB
random_02.txt AC 74 ms 87600 KB
random_03.txt AC 72 ms 87032 KB
random_04.txt AC 70 ms 88172 KB
random_05.txt AC 74 ms 87332 KB
random_06.txt AC 63 ms 81752 KB
random_07.txt AC 67 ms 82584 KB
random_08.txt AC 69 ms 84348 KB
random_09.txt AC 70 ms 85912 KB
random_10.txt AC 72 ms 82756 KB
random_11.txt AC 71 ms 82720 KB
random_12.txt AC 72 ms 82816 KB
random_13.txt AC 68 ms 81772 KB
random_14.txt AC 72 ms 82776 KB
random_15.txt AC 66 ms 81656 KB
random_16.txt AC 67 ms 81948 KB
random_17.txt AC 64 ms 81612 KB
random_18.txt AC 68 ms 81572 KB
random_19.txt AC 64 ms 81704 KB
random_20.txt AC 66 ms 81468 KB
random_21.txt AC 69 ms 81896 KB
random_22.txt AC 68 ms 81976 KB
random_23.txt AC 68 ms 81788 KB
random_24.txt AC 68 ms 81612 KB
random_25.txt AC 65 ms 81784 KB
random_26.txt AC 68 ms 81736 KB
random_27.txt AC 69 ms 81532 KB
random_28.txt AC 69 ms 81780 KB
random_29.txt AC 68 ms 81552 KB


2025-03-24 (Mon)
10:05:59 +00:00