07 2020 档案

摘要:AB 签到 C 计算子树内的人总数,然后可以计算出经过此节点时开心的人数目,然后若存在节点开心人数目小于儿子之和,则输出NO,反之输出YES,注意特判特殊情况 #include<bits/stdc++.h> #define int long long using namespace std; con 阅读全文
posted @ 2020-07-31 14:05 hfctf0210 阅读(189) 评论(1) 推荐(0)
摘要:A 签到 B 直接DP,f[i][j]表示前i步j步向左的最大值,位置可以直接计算 #include<bits/stdc++.h> using namespace std; const int N=1e5+7; int n,k,z,ans,a[N],f[N][6]; int main() { int 阅读全文
posted @ 2020-07-30 09:28 hfctf0210 阅读(153) 评论(0) 推荐(0)
摘要:用灰号打的div2但我还是写div1题解吧(因为div2前2题过水) A 可以发现这样的做法:每次找到最靠后的与b不同从串,然后通过旋转满足条件。但要判断a的第一位与该位是否相同,若相同,则需变换第1位使得其满足翻转后与该位相同,操作数2*n。至于翻转操作,打标记即可 #include<bits/s 阅读全文
posted @ 2020-07-22 08:32 hfctf0210 阅读(354) 评论(0) 推荐(0)
摘要:A 被这题卡住了,没写出来,想着类似AC自动机了,发现讨论一堆还可能有错。实质上就是每个位置枚举即可。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const string str="abacaba"; int 阅读全文
posted @ 2020-07-20 10:47 hfctf0210 阅读(269) 评论(0) 推荐(0)
摘要:本来打算写垫底记的,结果Unrated了,所以是题解了。 AB 太水了不写了 C 看到unrated就没写了,其实挺简单的。 容易发现答案只可能是0/1/2,情况如下: 0:无错误序列 1:错误序列均连续 2:其他情况(可以将其变为错误序列连续) #include<bits/stdc++.h> us 阅读全文
posted @ 2020-07-18 21:58 hfctf0210 阅读(223) 评论(0) 推荐(0)
摘要:退役一周年祭 A 没看清是任意顺序耽误了几分钟,首先最大值应该>=2个,若是3个则都为最大值,否则就两个次大值一个最大值 #include<bits/stdc++.h> using namespace std; int T,a[3]; int main() { cin>>T; while(T--) 阅读全文
posted @ 2020-07-18 21:54 hfctf0210 阅读(203) 评论(0) 推荐(0)
摘要:ABC 签到,过水已隐藏 D 做完第一次操作后数字只有2e5,位数很小,可以直接模拟了 #include<bits/stdc++.h> using namespace std; const int N=2e5+7; int n,n1,s1,s2,a[N],pw1[N],pw2[N]; char ch 阅读全文
posted @ 2020-07-11 21:51 hfctf0210 阅读(313) 评论(0) 推荐(0)
摘要:虽然CSP没过初赛没参加,但我还是想写一下题解 D1T1格雷码 按位考虑答案,第i位即为k xor [k/2]的第i位 #include<bits/stdc++.h> using namespace std; unsigned long long n,k; int main() { cin>>n>> 阅读全文
posted @ 2020-07-11 08:56 hfctf0210 阅读(234) 评论(0) 推荐(0)