Submission #21934332
Source Code Expand
Copy
def main():def rec(rem, lis, dep):if dep < 0:returnif rem == 0:if dep == 0:print(''.join(lis))else:lis.append('(')rec(rem - 1, lis, dep + 1)lis[-1] = ')'rec(rem - 1, lis, dep - 1)lis.pop()n = int(input())rec(n, [], 0)if __name__ == "__main__":main()
def main(): def rec(rem, lis, dep): if dep < 0: return if rem == 0: if dep == 0: print(''.join(lis)) else: lis.append('(') rec(rem - 1, lis, dep + 1) lis[-1] = ')' rec(rem - 1, lis, dep - 1) lis.pop() n = int(input()) rec(n, [], 0) if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | 002 - Encyclopedia of Parentheses(★3) |
User | riantkb |
Language | Python (3.8.2) |
Score | 3 |
Code Size | 409 Byte |
Status | AC |
Exec Time | 99 ms |
Memory | 8852 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 3 / 3 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 01_sample_04.txt |
All | 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 01_sample_04.txt, 02_all_01.txt, 02_all_02.txt, 02_all_03.txt, 02_all_04.txt, 02_all_05.txt, 02_all_06.txt, 02_all_07.txt, 02_all_08.txt, 02_all_09.txt, 02_all_10.txt, 02_all_11.txt, 02_all_12.txt, 02_all_13.txt, 02_all_14.txt, 02_all_15.txt, 02_all_16.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01_sample_01.txt | AC | 18 ms | 8764 KB |
01_sample_02.txt | AC | 23 ms | 8736 KB |
01_sample_03.txt | AC | 20 ms | 8684 KB |
01_sample_04.txt | AC | 23 ms | 8716 KB |
02_all_01.txt | AC | 16 ms | 8852 KB |
02_all_02.txt | AC | 19 ms | 8816 KB |
02_all_03.txt | AC | 21 ms | 8756 KB |
02_all_04.txt | AC | 20 ms | 8736 KB |
02_all_05.txt | AC | 18 ms | 8720 KB |
02_all_06.txt | AC | 19 ms | 8680 KB |
02_all_07.txt | AC | 17 ms | 8752 KB |
02_all_08.txt | AC | 27 ms | 8848 KB |
02_all_09.txt | AC | 18 ms | 8696 KB |
02_all_10.txt | AC | 27 ms | 8712 KB |
02_all_11.txt | AC | 21 ms | 8808 KB |
02_all_12.txt | AC | 36 ms | 8740 KB |
02_all_13.txt | AC | 33 ms | 8704 KB |
02_all_14.txt | AC | 46 ms | 8732 KB |
02_all_15.txt | AC | 56 ms | 8712 KB |
02_all_16.txt | AC | 99 ms | 8748 KB |