結果
| 問題 |
No.592 括弧の対応 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-22 18:43:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 567 bytes |
| コンパイル時間 | 158 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 22,236 KB |
| 最終ジャッジ日時 | 2024-09-25 10:13:52 |
| 合計ジャッジ時間 | 6,580 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 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)