coderforces
Weach
学生
展开
-
Codeforces Round #739 (Div. 3)
Codeforces Round #739 D. Make a Power of Two题意:给定数字num,给定两种操作1.从右边加入一个数2.删除任意一个数问最少多少次操作后所给数字能变成2n2^n2n的形式思路:注意到因为是从右边加入一个数字所以之前数字能在一个2的某次幂满足要求越多越好我们将[20,264][2^0,2^{64}][20,264]所有的数打表打出来,然后一个一个计算这个数变成2的某次幂的所需步骤取最小的即可。匹配的过程类似于KMP的过程#include<原创 2021-08-27 16:21:12 · 63 阅读 · 0 评论 -
2020 Jiangsu Collegiate Programming Contest D Delete Prime --分块+二分
2020 Jiangsu Collegiate Programming Contest D Delete Prime#include<bits/stdc++.h>#include <unordered_map>using namespace std;template<class...Args>void debug(Args... args) {//Parameter pack auto tmp = { (cout << args <&l原创 2021-08-09 11:11:58 · 178 阅读 · 0 评论 -
The 17th Zhejiang Provincial Collegiate Programming Contest C Crossword Validation--字典树
The 17th Zhejiang Provincial Collegiate Programming Contest #include<bits/stdc++.h>#include <unordered_map>using namespace std;template<class...Args>void debug(Args... args) {//Parameter pack auto tmp = { (cout << args <原创 2021-08-13 10:35:03 · 210 阅读 · 0 评论 -
The 17th Zhejiang Provincial Collegiate Programming Contest E Easy DP Problem--主席树
The 17th Zhejiang Provincial Collegiate Programming Contest E Easy DP Problem#include<bits/stdc++.h>#include <unordered_map>using namespace std;template<class...Args>void debug(Args... args) {//Parameter pack auto tmp = { (cout原创 2021-08-12 17:43:56 · 229 阅读 · 0 评论 -
The 17th Zhejiang Provincial Collegiate Programming Contest B. Bin Packing Problem--线段树
The 17th Zhejiang Provincial Collegiate Programming Contest B. Bin Packing Problem#include<bits/stdc++.h>#include <unordered_map>using namespace std;template<class...Args>void debug(Args... args) {//Parameter pack auto tmp = { (c原创 2021-08-12 11:47:33 · 144 阅读 · 0 评论 -
2021 Xinjiang Provincial Collegiate Programming Contest D. cocktail with swap --并查集
#include<bits/stdc++.h>#include <unordered_map>using namespace std;template<class...Args>void debug(Args... args) {//Parameter pack auto tmp = { (cout << args << ' ', 0)... }; cout << "\n";}typedef long lon原创 2021-08-01 11:26:03 · 323 阅读 · 0 评论 -
2021 Xinjiang Provincial Collegiate Programming Contest I. chino with mates --二分
#include<bits/stdc++.h>#include <unordered_map>using namespace std;template<class...Args>void debug(Args... args) {//Parameter pack auto tmp = { (cout << args << ' ', 0)... }; cout << "\n";}typedef long lon原创 2021-08-01 11:24:14 · 365 阅读 · 0 评论 -
The 15th Chinese Northeast Collegiate Programming Contest D. Lowbit --线段树
The 15th Chinese Northeast Collegiate Programming Contest D. Lowbit题目大意:对于给定序列有两种操作1 L R :修改区间[ L , R ]内的每个元素的值使其加上本身的lowbit值2 L R :询问区间[ L , R ]的和思路:乍一看被难住在操作 1 上区间内每个元素都要加上其本身的lowbit值,这不是退化到单点修改了吗,单点修改必然超时但通过lowbit性质可知int lowbit(int x) { // x原创 2021-07-24 11:50:36 · 358 阅读 · 0 评论 -
Codeforces Round #724 (Div. 2) B. Prinzessin der Verurteilung--sting的用法
Codeforces Round #724 (Div. 2) B. Prinzessin der Verurteilung#include<bits/stdc++.h>using namespace std;template <typename T> void debug(string s, T x) { cout << s << "=" << x << "\n"; }typedef long long ll;typedef原创 2021-06-09 20:37:23 · 176 阅读 · 1 评论 -
Codeforces Round #724 (Div. 2) D. Omkar and Medians--树状树组
Codeforces Round #724 (Div. 2) D. Omkar and Medians#include<bits/stdc++.h>using namespace std;template <typename T> void debug(string s, T x) { cout << s << "=" << x << "\n"; }typedef long long ll;typedef unsigned l原创 2021-06-09 19:14:27 · 177 阅读 · 0 评论 -
Codeforces Round #723 (Div. 2) B. I Hate 1111--数论,dp
定理:a,b互质,则a,b最大不能表示出的数是ab-a-b原创 2021-06-07 11:34:53 · 155 阅读 · 0 评论