AC Codeforces Round #499 (Div. 2) E. Border 扩展欧几里得

NoSuchKey