You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
statement
ให้ undi unweighted connected tree แต่ละ node มี '(' หรือ ')' อันใดอันนึงเพียงอันเดียว
มี q queries แต่ละ query ให้ คู่ node (u,v) ถามว่า sequence ที่ได้จากการเดินจาก u ไป v จะ valid มั้ย
sequence ของ path คือ sequence วงเลบของแต่ละโหนดที่เดินผ่านมาต่อกัน ต้องเกบทุกอัน ห้ามสลับที่
valid sequence ก็คือ valid paranthesis sequence
concept
DFS+LCA (ยังคิดโซลที่ใช้เนื้อหาไม่เกิน TOI ไม่ออก;-;)
notes
อาจจะปรับโจทย์ให้ยากขึ้น โดยเปลี่ยนจาก tree เป็น graph n nodes n edges
และเปลี่ยน query เป็นถามว่า มีวิธีในการเดินจาก u ไป v ให้ได้ valid seq. หรือไม่
Beta Was this translation helpful? Give feedback.
All reactions