結果
問題 |
No.3141 Balancing with X=>O Flip
|
ユーザー |
![]() |
提出日時 | 2025-05-16 22:42:11 |
言語 | Go (1.23.4) |
結果 |
TLE
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 15,613 ms |
コンパイル使用メモリ | 242,436 KB |
実行使用メモリ | 16,064 KB |
最終ジャッジ日時 | 2025-05-16 22:42:36 |
合計ジャッジ時間 | 16,569 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 1 -- * 19 |
ソースコード
package main import . "fmt" import . "strings" func main() { var n int var s string Scan(&n,&s) for { if check(s) { Println("Yes") return } if !Contains(s,")(") { Println("No") return } s=ReplaceAll(s,")(","()") } } func check(s string) bool { x:=0 for _,c:= range s{ if c=='(' { x++ } else { x-- if x <0 { return false } } } return x==0 }