시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
7 초 (추가 시간 없음) | 1024 MB | 21 | 11 | 10 | 52.632% |
There are four types of brackets: round ()
, square []
, curly {}
, and angle <>
. A bracket sequence is defined to be valid as follows:
You have a bracket sequence in which some brackets are given, but the others are unknown and represented by question marks (‘?
’). You shall fill in each unknown bracket using the four types of brackets described above and obtain a valid bracket sequence. How many different valid bracket sequences can you obtain?
The input has a single line giving a non-empty bracket sequence. The length of the sequence is even and no larger than 20. All sequence characters are either one of the four types of open or close brackets, or a question mark denoting an unknown bracket. There is at least one question mark in the sequence.
Output the number of different valid bracket sequences you can obtain.
(??)
5
(<{}>??]
1
(?]]
0
ICPC > Regionals > North America > Mid-Atlantic Regional > 2021 Mid-Atlantic USA Regional Contest F번
ICPC > Regionals > North America > North Central North America Regional > 2021 North Central NA Regional Contest K번