Codeforces习题集
等我学会后缀自动机
侠影之谜
展开
-
Codeforces Round #651 (Div. 2)(A,B,C,D,E)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,mid,rt<<1#define rson mid+1,r,rt<<1|1#defin.原创 2020-06-26 09:31:38 · 230 阅读 · 0 评论 -
Codeforces Round #646 (Div. 2) F Rotating Substrings(思维DP)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,mid,rt<<1#define rson mid+1,r,rt<<1|1#defin.原创 2020-06-14 15:59:40 · 232 阅读 · 0 评论 -
Codeforces Round #646 (Div. 2) E. Tree Shuffling
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,mid,rt<<1#define rson mid+1,r,rt<<1|1#defin.原创 2020-06-12 11:19:27 · 206 阅读 · 0 评论 -
Codeforces Round #648 (Div. 2) (A,B,C,D,E,F)
A#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,mid,rt<<1#define rson mid+1,r,rt<<1|1#de原创 2020-06-10 11:21:01 · 175 阅读 · 0 评论 -
Educational Codeforces Round 86 (Rated for Div. 2) D. Multiple Testcases(思维)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,mid,rt<<1#define rson mid+1,r,rt<<1|1#defin.原创 2020-05-31 14:31:14 · 122 阅读 · 0 评论 -
CodeForces 454D Little Pony and Harmony Chest (状压DP+估界)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-26 07:46:46 · 136 阅读 · 0 评论 -
CodeForces 315E Sereja and Subsequences (权值线段树+DP)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-25 22:46:27 · 110 阅读 · 0 评论 -
CodeForces 315D Sereja and Periods (思维DP)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-25 07:59:31 · 165 阅读 · 0 评论 -
CodeForces 270D Greenhouse Effect (DP+LIS)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-23 16:39:55 · 159 阅读 · 0 评论 -
CodeForces 320D Psychos in a Line (单调栈+DP)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-21 10:40:29 · 144 阅读 · 0 评论 -
CodeForces 214E Relay Race (DP+思维)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-19 19:35:26 · 233 阅读 · 1 评论 -
CodeForces 214D Numbers (DP+组合数学+前导零的细节)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-19 19:33:37 · 175 阅读 · 0 评论 -
CodeForces 284E Coin Troubles (DP+判环+背包)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-12 20:52:16 · 150 阅读 · 0 评论 -
CodeForces 155C Hometask (DP+复杂做法)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-12 16:31:36 · 161 阅读 · 0 评论 -
CodeForces 1260F Colored Tree (树剖+计数思维+一点点DP思维)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-10 11:35:25 · 157 阅读 · 0 评论 -
CodeForces 239E World Eater Brothers (DP)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-09 23:26:09 · 117 阅读 · 0 评论 -
CodeForces 373E Watching Fireworks is Fun (DP+单调队列优化)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-04-05 21:26:05 · 159 阅读 · 0 评论 -
CodeForces 1062E Company (主席树第k大+dfs序性质)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-03-30 21:53:22 · 195 阅读 · 0 评论 -
CodeForces 373D Counting Rectangles is Fun (四维DP)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-03-27 16:29:07 · 151 阅读 · 0 评论 -
CodeForces 853C Boredom (主席树+分类讨论)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-03-27 10:36:50 · 182 阅读 · 0 评论 -
CodeForces 208E Blood Cousins (启发式合并+倍增)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-03-20 00:12:15 · 138 阅读 · 0 评论 -
CodeForces 246E Blood Cousins Return (树上启发式合并)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-03-18 08:36:07 · 175 阅读 · 0 评论 -
CodeForces 1254D Tree Queries (树链剖分技巧+树状数组)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-02-19 12:11:01 · 281 阅读 · 0 评论 -
CodeForces 484E Sign on Fence (主席树+二分+排序思维)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-02-14 22:25:36 · 186 阅读 · 0 评论 -
CodeForces 813E Army Creation 主席树+预处理
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,m...原创 2020-02-09 09:36:10 · 89 阅读 · 0 评论 -
CodeForces 600E Lomsat gelral 树上启发式合并
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);x++)#define mst(x,y) memset(x,y,sizeof(x))#define ll long longconst int maxn=1e5+10;const int maxk...原创 2020-02-02 23:31:43 · 203 阅读 · 0 评论 -
Codeforces round 488 div2 B. Knights of a Polygonal Table
B. Knights of a Polygonal Tabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUnlike Knights of a Round Table, Knights of a Polygonal Table depriv...原创 2018-06-23 19:56:48 · 130 阅读 · 0 评论 -
Codeforces Round 491 div2 C Candies (典型下边界二分)
C. Candiestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter passing a test, Vasya got himself a box of nn candies. He decided to eat an equal a...原创 2018-06-24 09:39:39 · 316 阅读 · 0 评论 -
Codeforces Round Educational C. Covered Points Count (维护区间和)
C. Covered Points Counttime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given nn segments on a coordinate line; each endpoint of every segm...原创 2018-06-29 11:13:48 · 541 阅读 · 0 评论 -
Codeforces Round 491 Bishwock (超超简单的dp+细节)
D. Bishwocktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBishwock is a chess figure that consists of three squares resembling an "L-bar". This fi...原创 2018-06-25 18:10:00 · 273 阅读 · 0 评论 -
Codeforces 837D Round Set (二维背包dp)
Let's call the roundness of the number the number of zeros to which it ends.You have an array of n numbers. You need to choose a subset of exactly k numbers so that the rou...原创 2018-06-26 22:26:31 · 202 阅读 · 0 评论 -
Codeforces round 493 div2 B.Cutting (贪心技巧)
B. Cuttingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are a lot of things which could be cut — trees, paper, "the rope". In this problem...原创 2018-07-02 21:16:54 · 301 阅读 · 0 评论 -
Codeforces round 493 Convert to Ones(单纯技巧+一点数学知识)
C. Convert to Onestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got a string a1,a2,…,ana1,a2,…,an, consisting of zeros and ones.Let's call...原创 2018-07-02 21:18:04 · 328 阅读 · 0 评论 -
Codeforces 373C Counting Kangaroos is Fun(双游标贪心)
There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least t...原创 2018-06-27 18:31:02 · 146 阅读 · 0 评论 -
Codeforces educational round 46 B Light It Up(贪心+维护变量)
B. Light It Uptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently, you bought a brand new smart lamp with programming features. At first, you ...原创 2018-06-28 06:38:37 · 377 阅读 · 0 评论 -
Codeforces 498 (div 3) C. Three Parts of the Array (二分找下界)
You are given an array d1,d2,…,dnd1,d2,…,dn consisting of nn integer numbers.Your task is to split this array into three parts (some of which may be empty) in such a way that each element of the arr...原创 2018-07-17 07:58:44 · 370 阅读 · 0 评论 -
Codeforces round 591E Three States (思维优化BFS)
The famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all member states to freely pass through the terr...原创 2018-07-23 22:12:22 · 137 阅读 · 0 评论 -
Codeforces 877E Danil and a Part-time Job(DFS序构造线段树+区间维护)*
Danil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher.Danil works in a rooted tree (undirected connected acyclic graph) with ...原创 2018-07-20 08:09:05 · 134 阅读 · 0 评论 -
Codeforces 618 D Hamiltonian Spanning Tree (思维+DFS找路径)*
A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are roads in total. It takes exactly y seconds to traverse any single road....原创 2018-07-26 16:19:23 · 255 阅读 · 0 评论 -
Codeforces 864D Make a Permutation! (贪心+维护)思维好题
Ivan has an array consisting of n elements. Each of the elements is an integer from 1 to n.Recently Ivan learned about permutations and their lexicographical order. Now he wants to change (replace) ...原创 2018-07-27 11:25:24 · 184 阅读 · 0 评论