結果
| 問題 |
No.592 括弧の対応 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-22 18:42:11 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 554 bytes |
| コンパイル時間 | 348 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-09-25 10:13:11 |
| 合計ジャッジ時間 | 799 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 3 |
ソースコード
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)