結果
問題 | No.457 (^^*) |
ユーザー |
![]() |
提出日時 | 2020-02-02 19:07:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 714 bytes |
コンパイル時間 | 127 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-09-18 21:20:30 |
合計ジャッジ時間 | 1,756 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = read().rstrip().decode() dp = [0,0,0,0] l_complete = 0 for x in S: if x == '(': dp[0] += 1 elif x == '^': dp[2] += dp[1] dp[1] = dp[0] dp[0] = 0 elif x == '*': dp[3] += dp[2] dp[2] = 0 elif x == ')': l_complete += dp[3] dp = [0,0,0,0,0] r_complete = 0 for x in S: if x == '(': dp[0] += 1 elif x == '^': dp[3] += dp[2] dp[2] = dp[1] dp[1] = 0 elif x == '*': dp[1] += dp[0] dp[0] = 0 elif x == ')': r_complete += dp[3] print(l_complete, r_complete)