結果
| 問題 | No.3503 Brackets Stack Query 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 05:19:22 |
| 言語 | Go (1.26.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 514 bytes |
| 記録 | |
| コンパイル時間 | 13,977 ms |
| コンパイル使用メモリ | 278,700 KB |
| 実行使用メモリ | 15,012 KB |
| 最終ジャッジ日時 | 2026-04-18 05:20:53 |
| 合計ジャッジ時間 | 28,856 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | AC * 4 TLE * 4 -- * 22 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
Q, _ := strconv.Atoi(scanner.Text())
S := ""
for i := 0; i < Q; i++ {
scanner.Scan()
q := scanner.Text()
if q[0] == '1' {
S += string(q[2])
} else {
if len(S) > 0 {
S = S[:len(S)-1]
}
}
t := S
for strings.Contains(t, "(|)") {
t = strings.ReplaceAll(t, "(|)", "")
}
if t == "" {
fmt.Println("Yes")
} else {
fmt.Println("No")
}
}
}