• 2024-01-17[AGC010E] Rearranging
    Thereare$N$integerswrittenonablackboard.The$i$-thintegeris$A_i$.TakahashiandAokiwillarrangetheseintegersinarow,asfollows:First,Takahashiwillarrangetheintegersashewishes.Then,Aokiwillrepeatedlyswaptwoadjacentintege
  • 2023-09-04[ABC317G] Rearranging
    ProblemStatementThereisagridwith$N$rowsand$M$columns.Thesquareatthe$i$-throwfromthetopandthe$j$-thcolumnfromtheleftcontainstheinteger$A_{i,j}$.Here,thesquarescontain$M$occurrencesofeachof$1,\ldots,N$,foratotalo
  • 2023-08-27[ABC317G] Rearranging 题解
    取自我的洛谷博客:https://www.luogu.com.cn/blog/SunnyYuan/solution-at-abc317-g借鉴了官方题解思路。思路首先我们要建立一个二分图。对于输入的\(a_{i,j}\),我们可以连接左侧的\(i\)和右侧的\(a_{i,j}\)。比如样例\(1\):注意:左边的\(1,2,3\)和右边的\(1,2