結果
問題 |
No.3143 Colorless Green Parentheses Sleep Furiously
|
ユーザー |
![]() |
提出日時 | 2025-05-16 23:30:05 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 15,278 ms |
コンパイル使用メモリ | 240,576 KB |
実行使用メモリ | 10,520 KB |
最終ジャッジ日時 | 2025-05-17 00:36:46 |
合計ジャッジ時間 | 29,818 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 47 WA * 2 |
ソースコード
package main import . "fmt" import . "strings" func main() { var n,k int var s string Scan(&n,&k,&s) if n%2==1 { Println("No") return } if Count(s,"(")!=Count(s,")"){ Println("No") return } t:="" x:=0 for i,c:=range s { if c=='(' { x++ if i>0&&s[i-1]==')' { t+="+" } t+="(" } else { x-- if x<0 { Println("No") return } if s[i-1]=='(' { t+="1+1)" k-=2 } else { t+="+1)" k-- } if k <0 { Println("No") return } } } t+=Repeat("+1",k) if x==0 { Println("Yes") Println(t) } else { Println("No") } }