結果
| 問題 |
No.592 括弧の対応 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-22 18:42:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 585 bytes |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 22,232 KB |
| 最終ジャッジ日時 | 2024-09-25 10:13:42 |
| 合計ジャッジ時間 | 6,719 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | TLE * 1 -- * 2 |
ソースコード
_ = input()
sq = list(input())
for i in range(len(sq)):
if sq[i] == '(':
s = 1
psq = sq[i+1:]
for j in range(len(psq)):
if psq[j] == '(':
s += 1
else:
s -= 1
if s == 0:
break
print(i+j+2)
else:
s = 1
psq = sq[:i]
for j in range(len(psq)):
if psq[-(j+1)] == ')':
s += 1
else:
s -= 1
if s == 0:
break
print(i-j)
print(i-j)