結果

問題 No.2143 Only One Bracket
ユーザー lam6er
提出日時 2025-03-31 17:43:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 53,900 KB
最終ジャッジ日時 2025-03-31 17:44:51
合計ジャッジ時間 2,552 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 1:
    # According to constraints, n starts from 2, but handle if needed
    print("()")
else:
    # Create one string as a single ')'
    print(")")
    # Create n-1 strings, each contributing +1 net, forcing a unique order
    for i in range(1, n):
        # Each of these strings is "((...))" with i opening and i-1 closing
        s = '(' * (i + 1) + ')' * i
        # Trim if necessary, but for the given constraints, it should fit within n^2
        print(s[:2*i + 1])
0