rearrangement
[AGC010E] Rearranging
[AGC010E] Rearranging 先思考给一个序列,如何求出交换后的最大字典序 显然,不互质的数之间的相对顺序不会改变,于是可以用拓扑排序求出最大字典序 那考虑先手策略,第一次时找出最小的数,向所有和他不互质的数连有向边,并将这些数向比他小的不互质的数连边,第若干次操作选的必须是已经和第一 ......
Atcoder-ABC317G-Rearranging
ABC317G - Rearranging 题意 给出一个 \(n\) 行 \(m\) 列的矩阵,可以将每一行的 \(m\) 个数重新排列,问能不能得到 \(m\) 列都是 \(n\) 的排列的矩阵,能得到则输出任意一个方案。 给出的矩阵满足对于 \(i \in [1,n]\) ,都恰好出现了 \( ......
[LeetCode] 1727. Largest Submatrix With Rearrangements
You are given a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order. Return the area of the la ......
[LeetCode] 2149. Rearrange Array Elements by Sign
You are given a 0-indexed integer array nums of even length consisting of an equal number of positive and negative integers. You should rearrange the ......
String Rearrangement in Phantom
先考虑一个 \(O(nq)\) 的暴力,令 \(s_{1}=S[l_{1},r_{1}],s_{2}=S[l_{2},r_{2}]\),令 \(t=\operatorname{rev}(s_{2})\),则我们仅需求 \(s_{1}=A+B+C,t=\operatorname{rev}(A)+B+\ ......
[ABC317G] Rearranging
Problem StatementThere is a grid with $N$ rows and $M$ columns. The square at the $i$-th row from the top and the $j$-th column from the left contains ......
AtCoder Beginner Contest 317 G Rearranging
[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc317_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc317/tasks/abc317_g "AtCoder 传送门") 考虑转化成匹配问题 ......
[ABC317G] Rearranging 题解
取自我的洛谷博客:https://www.luogu.com.cn/blog/SunnyYuan/solution-at-abc317-g 借鉴了官方题解思路。 ## 思路 首先我们要建立一个二分图。 对于输入的 $a_{i, j}$,我们可以连接 左侧的 $i$ 和 右侧的 $a_{i, j}$。 ......
AGC010E Rearranging
考虑先手操作完后得到的序列为 $b_i$,后手如何操作得到最大答案。 由于不互质的数不能交换,所以任意一对 $i<j,\text{gcd}(b_i,b_i)\neq 1$,后手操作后相对顺序不变。 所以可以枚举每对不互质的数,编号小的往大的连边,然后用优先队列跑最大拓扑序。 再考虑先手如何操作。 容 ......
AtCoder Beginner Contest 247 Ex Rearranging Problem
[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc247_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc247/tasks/abc247_h "AtCoder 传送门") 考虑我们如何判定一 ......
论文阅读笔记(五):Hire-MLP Vision MLP via Hierarchical Rearrangement
论文阅读笔记(五):Hire-MLP: Vision MLP via Hierarchical Rearrangement 摘要 先前的MLPs网络接受flattened 图像patches作为输入,使得他们对于不同的输入大小缺乏灵活性,并且难以捕捉空间信息,本问Hire-MLP通过层次化重排构建视 ......