跳到正文

个人记录

2026.2.2 VP CF 1075(Div.2)

yiming1123约 4 分钟
原文
文章信息与版本

文章信息

收录
2026年2月2日
更新
2026年2月2日
篇幅
约 4 分钟

版本

  1. v1当前

A。发现自己的阅读理解能力下降了,以及睡眠时间不太够。

B 明显是一个贪心,在尽可能地把免费的贪完后,在回滚中选取一个代价最小的。然后,结论显然,我们需要向上取整,对于这道题的题意应该这样写 x=(x-1+y)/y。所以:

  • 向下取整:x=(x-1)/y+1
  • 向上取整:x=(x-1+y)/y

当复习了。

C1 在乱撞时或许能想起网络流中的一个技巧,即从 00 开始,每两个相邻正整数划分的二元组亦或值为 11。有了这个性质,我们就可以把 11 填入 outputnoutput_n 以满足其之前所有二元组交叉填入符合条件。最后 output1output_1 为剩下的那一个未使用的数。可以发现其值有这个规律:

output1={n−1x为奇数nx为偶数output_1=\begin{cases} n-1 & x 为奇数\\ n & x 为偶数\\ \end{cases}

C2 就需要猜出:若 n=2k(k∈Z)n=2^k(k\in \Z),则无解。再考虑 n=2k+r(k∈Z,r<2k)n=2^k+r(k\in \Z,r<2^k)。可以明白 n⊕r=2k+r⊕r=2kn\oplus r=2^k+r\oplus r=2^k,我们 swap(a1,ar)(a1=n)swap(a_1,a_r)(a_1=n),因为 2k2^k 一定在 rr 位置之后,故这样换能满足题意;被换走的 ara_r 同理。

D1 的体面为什么要放与 D1 无关的内容?对阅读障碍认识很不友好。:(

实在不想写这个了,把题解复制过来就去写题吧,快点找回状态,争取这次集训过后思维题能稳切黄。

Let’s consider which permutations p satisfy the condition of the string w. It is obvious that if w1=0 or wn=0, there are no suitable p (in any permutation, there is a subsegment with only the number 0 and a subsegment with all numbers), so we will assume that w1=wn=1. Let’s construct p, starting with p=[0] and sequentially inserting the numbers 1,2,…,n−1 into some positions.

Suppose we have placed the numbers 0,1,…,k−1 and are now going to insert the number k relative to them. We have k+1 options for where to insert it.

If we insert k before all the numbers or after all the numbers, we can always choose all remaining numbers as a segment and get mex=k (note that inserting subsequent numbers will not affect the mex of this segment, since all subsequent values are >k).

However, if we insert k between some values, we will have a situation where there is a value <k both to the left and to the right of k. Then, to achieve mex=k, we need to collect all numbers <k, but since they exist both to the left and to the right, we will include k, resulting in mex>k.

In total, we have 2 options for ensuring wk=1, and k−1 options for wk=0. We have derived that

f(w)=∏n−1i=1{2i−1if wi=1otherwise In this version of the problem, w=s, so we only need to check whether f(w) is divisible by c. To do this, we will iterate through all i and reduce c by the greatest common divisor of the current factor and the number c. If we end up with c=1, then the answer is −1. Otherwise, the answer is f(w).

Link

原文